1 条题解
-
0
自动搬运
来自洛谷,原作者为

chen_zhe
Aya 敲可爱的~搬运于
2025-08-24 21:14:53,当前版本为作者最后更新于2025-03-09 14:08:20,作者可能在搬运后再次修改,您可在原文处查看最新版自动搬运只会搬运当前题目点赞数最高的题解,您可前往洛谷题解查看更多
以下是正文
欢迎报名洛谷网校,期待和大家一起进步!
本题并非传统意义上的算法竞赛题。本题考察做题直觉。
题目要求区分是汉语拼音还是英文写的文本。我们来回忆我们学过的拼音,拼音的最长长度是 ,例如说创(chuang),装(zhuang),霜(shuang)。而英语通常能够出现长度大于 的单词,例如说
Pumas are large, cat-like animals which are found in America.(出自新概念英语 3 第一课 A puma at large ),其中的animals,America都是长度大于 的单词。因此,如果一篇文本存在一个单词长度大于 ,判断它是英语即可。bool flag = true; cin >> n; for (int i = 1; i <= n; i++) { string s; cin >> s; if (s.length() > 6) flag = false; } if (flag) cout << "Pinyin" << endl; else cout << "English" << endl;有的人可能会说,如果出现下面这样的例子应当如何处理呢?
one two three four five six seven eight nine ten。实际上,本题的文本都来自真实、易于人类阅读的文本,对于一篇长度超过 个字符的文本,其很难出现类似于这个例子中如此简单的词汇堆砌。当然也确实存在这样的文本,例如(贡献者:MatrixGroup):once upon a time there was a mouse and a lion the mouse was little but the lion was large the mouse was weak but the lion was very strong they lived in the wild with joy one day a lot of food began to appear in a sudden how lucky we are mr lion said the little mouse yes indeed said the lion they both felt so happy that they began to sing and dance thing did not go well always though the lion said that he should eat more since the mouse was weaker so the mouse did not need to eat a lot the mouse did not think so he said they should get the same amount of food a war broke out at once they argued they fought the lion was not weak indeed but the but the mouse was nimble and clever a day passed a week passed a month passed the war still did not come to an end they both felt very tired as a result the mouse gave advice why not just eat the food every day and wait until the food have been eaten out said the mouse it is a good idea said the lion but what if i eat a lot more than i should eat every day the mouse began to think for a while and gave a reply well said the little mouse i do not think that you can eat much more food than you need every day you are right how clever you are said the lion from then on they lived with joy again in the wild they ate and they did not need to look for food how joyful they were at that time sadly as the little mouse said the food would be eaten up one day the day came at last they had to look for food busily every day again due to days of being lazy they could hardly find any food after being hungry for days they could not bear the starve any more the mouse began to learn how to eat grass but what about the lion was he going to eat the mouse he seemed to start doing that it was a close call but all of a sudden a melon rolled down a hill and hit the lion the lion was very angry at first but after he found that the melon could be eaten he was not angry any more what is more he found that the melon was very sweet and juicy the lion and the mouse wanted to get more melons like that that is the reason why they walked day by day with no stop when they were hungry they ate grass when they were very tired they said to each other if we arrive there there will be a lot of melons and maybe some other food on their way there the views were very fair the flower danced with the wind the birds sang lovely songs the water flowed fast the mouse and the lion was deeply moved how magic the nature is how great the nature is they cried with the joy of fair views they got there at the end it was a jungle there were a lot of trees what is more there were all kinds of trees there are also many plants on the ground the mouse and the lion both began to shout what an ideal place to live with the free fruit they became happy again but this time they would not become lazy as the saying goes a fall into the pit a gain in your wit they began to run around the trees every day the mouse was no longer weak and the lion became as strong as he used to be one day some wolves came they said the jungle was their place and they did not allow the mouse and the lion to live in the jungle the little mouse was so afraid of the wolves that he could not say any words it was lucky for the mouse that the lion could never be afraid since lions are the king of the animal world the lion fought with some wolves for a while and none of them was alive all the wolves left began to raise the white flag the mouse and the lion lived with the wolves from then on the wolves also gave them a lot of help say when it rained a lot so it was very hard to walk the wolves took them to the places where a lot of food was stored that was great if there came a storm they also gave some help to the wolves in return when others tried to attack the wolves the lion came to help they lived in the jungle with great joy they also had fun in the jungle they had a party four times a year during a party they sang they danced and they ate a lot birds also sang with them one day the flood broke out a lot of water flowed here and there in the jungle they had no choice but to escape they left the jungle and each of them is alone after the lion became safe he felt very lonely will i meet the mouse and the wolves again one day he began to wonder he felt so blue that he even could not eat he stayed there just to wait for the mouse and the wolves to find him an idea came into his mind in a sudden why not go and find them by myself he began to think then he began to run and never had a rest he really wanted to live with the little mouse and the wolves he really missed that time though he knew that this might be a search that would never end he kept going day by day on the way back
参考翻译:
从前,有一只老鼠和一头狮子。老鼠很小,而狮子很大;老鼠很弱,而狮子非常强壮。他们快乐地生活在荒野中。
有一天,突然出现了很多食物。
“小狮先生,我们真是太幸运了!”小老鼠说道。
“确实如此。”狮子回答。
他们都感到非常高兴,以至于开始唱歌跳舞。然而,事情并不总是顺利。狮子认为自己应该吃得更多,因为老鼠比他弱,不需要吃那么多。但老鼠不同意,他认为他们应该获得相同的食物份量。
于是,一场战争爆发了。他们争论,他们打斗。狮子确实不弱,但老鼠却敏捷又聪明。一天过去了,一周过去了,一个月过去了,战争仍未结束。他们都感到非常疲惫。
最终,老鼠提出了一个建议:“我们每天吃食物,直到食物吃完为止,如何?”
“这是个好主意。”狮子说道,“但如果我每天吃得比我应该吃的还要多呢?”
老鼠思考了一会儿,然后回答道:“嗯,我不认为你每天能吃比自己所需更多的食物。”
“你说得对,你真聪明!”狮子赞叹道。
从那以后,他们又快乐地生活在荒野里。他们吃着现成的食物,不再需要寻找食物,生活充满了欢乐。
然而,正如小老鼠所说,食物终有吃完的一天。最终,这一天还是来了。他们不得不再次忙碌地寻找食物。然而,由于长时间的懒惰,他们很难找到食物。几天的饥饿让他们难以忍受。小老鼠开始学着吃草,但狮子呢?他会吃掉老鼠吗?看起来他似乎正打算这么做。千钧一发之际,突然,一个大瓜从山上滚下来,砸到了狮子。
狮子起初很生气,但当他发现这个瓜可以吃时,他便不再生气了。而且,这个瓜又甜又多汁。狮子和老鼠想要找到更多这样的瓜。
于是,他们日复一日地不停行走。当他们饿了,就吃草;当他们疲惫时,他们彼此鼓励:“如果我们到达那里,就会有许多瓜,也许还有其他食物。”
一路上,风景秀丽:花儿随风起舞,鸟儿唱着美妙的歌,流水潺潺。狮子和老鼠深受感动,他们欢呼:“大自然真神奇!大自然真伟大!”
最终,他们到达了一个丛林。那里有许多树,各种各样的树,还有地上的植物。老鼠和狮子兴奋地喊道:“多么理想的居住之地啊!”他们可以自由地吃果子,变得幸福起来。但这一次,他们不会再变得懒惰了。正如那句谚语所说:“吃一堑,长一智。”他们每天都围着树跑步锻炼。老鼠不再弱小,而狮子也恢复了往日的强壮。
一天,一群狼来了。它们说这片丛林是它们的地盘,不允许狮子和老鼠在这里生活。小老鼠害怕得说不出话来。幸运的是,狮子从不害怕,因为狮子是动物世界的王者。狮子与狼群激战了一番,最后所有的狼都败下阵来,剩下的狼纷纷举起了白旗。
从那以后,狮子和老鼠与狼群一起生活。狼群也给予了他们很多帮助,比如在大雨使道路难行时,狼带他们去储藏食物的地方。狮子和老鼠也会回报狼群的帮助,比如当有敌人袭击狼群时,狮子会挺身而出保护他们。
他们在丛林里过着快乐的生活。他们还会在每年举行四次盛大的聚会,唱歌、跳舞、尽情享受美食,鸟儿们也会与他们同乐。
然而,有一天,洪水爆发了,大量的水冲刷着丛林,他们不得不逃离。他们四散奔逃,各自失散了。
狮子在安全后感到非常孤独。他开始思考:“我还能再见到小老鼠和狼群吗?”他的心情非常低落,甚至吃不下东西。他停留在原地,等待小老鼠和狼群来找他。
突然,他灵光一闪:“为什么不自己去找他们呢?”
想到这里,他立刻行动,开始奔跑,从未停歇。他真的很想再次和小老鼠、狼群生活在一起。他真的很怀念那段时光。尽管他知道,这或许是一个永无止境的寻找旅程,但他依然日复一日地奔跑在回去的路上……
再分享另外一种做法,可以抓住英语单词中最高频的词汇们:this,that,the,its,his,her,your 等常见的代词,如果读入的文本出现了这些代词,那么它就是英语。但是 AI 依然能帮助我们构造此类反例,下一段例文来自 Deepseek R1:
Spring awakens dormant flora. Blossoms burst from branches, painting hillsides with vibrant hues. Gentle rains nourish roots, encouraging growth across meadows. Birds construct nests among leafy canopies while insects hum in sunlit fields.
Summer radiates relentless warmth. Rivers shimmer under bright skies, reflecting cotton-like clouds. Cicadas drone in sync with rustling grass. Farmers tend crops under golden daylight, harvesting ripe produce for bustling markets.
Autumn chills air, turning foliage crimson and amber. Crisp winds scatter fallen leaves, forming carpets on forest floors. Squirrels gather acorns, storing food for colder months. Fog settles over valleys at dawn, softening horizons.
Winter arrives with silent snowfall. Icicles cling to rooftops, glinting in pale moonlight. Footprints mark trails through powdery drifts as smoke curls from chimneys. Frozen lakes mirror starry nights, capturing stillness in crystalline surfaces.
Nature’s cycles continue endlessly, each phase shaping environments anew. Observers witness beauty in transitions, finding wonder in Earth’s perpetual dance.
参考翻译:
春唤醒沉睡植物。花朵从枝头绽放,以明艳色彩点染山坡。细雨滋润根系,催发草甸蓬勃生长。鸟类在繁茂树冠间筑巢,昆虫在阳光倾洒的田野嗡鸣。
夏散发炽热能量。河流在晴空下粼粼闪光,倒映棉絮般的云朵。蝉鸣与窸窣草叶共振。农人在金色日光下照料庄稼,为喧闹集市采收成熟果实。
秋携寒意浸染空气,将树叶染作绯红与琥珀。清冽风卷落叶,于林间铺就斑斓地毯。松鼠收集橡果,为严寒时节储藏食物。晨雾漫过山谷,柔化天地交界。
冬伴随寂静飘雪降临。冰棱悬垂屋檐,在苍冷月色中闪烁微光。足迹穿越蓬松雪堆,炊烟自烟囱袅袅升起。冰封湖泊映出繁星夜空,将凝滞时刻封存于剔透冰面。
自然规律永恒轮转,每个阶段重塑环境样貌。观者于变迁中捕捉美,在地球永续舞动里寻得惊叹。但是除非是这种刻意构造的情况,其他的情况下本文所述的做法都可以被认为是正确的。
- 1
信息
- ID
- 8622
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 3
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者