随笔分类 -  紫书

摘要:题意:n个人围成个圆,从1到n,一个人从1数到k就让第k个人离场,了另一个人从n开始数,数到m就让第m个人下去,直到剩下最后一个人,并依次输出离场人的序号。水题,直接上标程了#include#define maxn 25int n, k, m, a[maxn];// ... 阅读全文
posted @ 2018-09-16 14:38 浮生惘语 阅读(99) 评论(0) 推荐(0)
摘要:题意:就是给出一个字符串,让你去一个一个猜测,相同字母算一次,如果是之前猜过的也算错,如果你在错7次前猜对就算你赢,文章中是LRJ的例题代码。#include#include#define maxn 100int left, chance;char s[maxn], ... 阅读全文
posted @ 2018-09-16 14:33 浮生惘语 阅读(77) 评论(0) 推荐(0)
摘要:题意:给定两个字符串,你可以替换或者置换,替换是指可以将相同的字母替换为任意一个字母,而置换是指将字母替换为下一个,如A替换B,B替换为C,,,Z替换为A。你需要判断是否可以通过一系列操作使两个字符串相等。思路:既然可以替换和置换,那么我们就可以用两个数组统计两个字符... 阅读全文
posted @ 2018-08-28 09:54 浮生惘语 阅读(95) 评论(0) 推荐(0)
摘要:输入两个字符串s和t,判断是否可以从t中删除0个或者多个字符(其他字符顺序不变),得到字符串s。例如,abcde可以得到bce,但无法得到cb。Input输入多组数据每组一行包含两个字符串s和t,两字符串之间用空格隔开。字符串长度在100000以内Output输出Ye... 阅读全文
posted @ 2018-08-16 00:52 浮生惘语 阅读(119) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include using namespace std; char maps[5][7];char cmd[1001]; int main(){ int cases = 0;... 阅读全文
posted @ 2018-07-29 23:18 浮生惘语 阅读(101) 评论(0) 推荐(0)
摘要:如果一个字符串可以被某个长度为k的字符串重复多次得到,则称这个字符串的周期为k。例如,字符串“abcabcabcabc”以3为周期(当然,他也以6、12等等为周期)。 现在请你编写一个程序,求出任一长度不超过80的字符串的最小周期。Input输入首先是一个整数n,代表... 阅读全文
posted @ 2018-07-29 23:15 浮生惘语 阅读(117) 评论(0) 推荐(0)
摘要:Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers startin... 阅读全文
posted @ 2018-07-29 23:14 浮生惘语 阅读(89) 评论(0) 推荐(0)
摘要:HJL是一个从不讽刺人的品学兼优的好孩子,她最近沉迷学习化学而不能自拔。然而计算一个分子的相对分子质量使她烦不胜烦,因此她决定请你写一个程序来帮助她计算这种麻烦的事情。已知:①C代表的碳元素的相对原子质量为12.01,H代表的氢元素的相对原子质量为1.008,O代表的... 阅读全文
posted @ 2018-07-29 23:12 浮生惘语 阅读(132) 评论(0) 推荐(0)
摘要:如何计算你们的得分呢?,如“OOXXOXXOOO”。 “O”表示问题的正确答案,“X”表示错误的答案。那么它得分是由它自己和它刚刚以前连续的'O'只有当答案是正确的。例如,第10个问题的分数是由其自身和它的两个先前连续的“0”获得的3。因此,“OOXXOXXOOO”的... 阅读全文
posted @ 2018-07-29 23:11 浮生惘语 阅读(593) 评论(0) 推荐(0)
摘要:Some DNA sequences exist in circular forms as inthe following gure, which shows a circular sequence\CGAGTCAGCT", that is, the last sym... 阅读全文
posted @ 2018-07-18 08:33 浮生惘语 阅读(142) 评论(0) 推荐(0)
摘要:For a positive integer N , the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N , we call ... 阅读全文
posted @ 2018-07-18 08:30 浮生惘语 阅读(102) 评论(0) 推荐(0)
摘要:MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is n... 阅读全文
posted @ 2018-07-18 08:23 浮生惘语 阅读(135) 评论(0) 推荐(0)
摘要:A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a ... 阅读全文
posted @ 2018-07-17 13:14 浮生惘语 阅读(126) 评论(0) 推荐(0)
摘要:A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "... 阅读全文
posted @ 2018-07-17 13:06 浮生惘语 阅读(148) 评论(0) 推荐(0)
摘要:TeX is a typesetting language developed by Donald Knuth. It takes source text together with a few typesetting instructions and produce... 阅读全文
posted @ 2018-07-17 12:59 浮生惘语 阅读(160) 评论(0) 推荐(0)