摘要:
这样简单的题做了半个小时,我学会了一个道理,要认真读题.....(漏读了一个同时交换..) 题意:有n个小朋友围成一圈坐,每个人手上分别有 a ,b ,c...个糖果。老师每吹一次哨音,小朋友将手上的糖果拿出一半,交给其右边的人(顺时针),如果交换后有小朋友的手上糖果数为奇数,则老师将再给他一颗糖果 阅读全文
posted @ 2019-07-16 20:59
Tianwell
阅读(216)
评论(0)
推荐(0)
摘要:
题意:T个例子,n堆,然后对应 堆的个数 a, b c .... 还是alice先拿再bob ,游戏规则相对Nim博弈有些不一样。这次是将每堆分成两堆,且所分堆的个数必须大于等于1 . 问谁能赢; 思路:根据sg函数结论求值 1.最终局面sg值为0则先手必输 2.所有子游戏的sg值异或后等于原游戏的 阅读全文
posted @ 2019-07-16 17:15
Tianwell
阅读(179)
评论(0)
推荐(0)
摘要:
题意: 给出一个很大的数字(很长的字符串),然后将其位数相加 如果大于10则继续相加 直到结果小于10,输出结果 思路: 用string来记录不定长的字符串,然后将其用while()循环处理 阅读全文
posted @ 2019-07-16 16:08
Tianwell
阅读(95)
评论(0)
推荐(0)
摘要:
一时水题一时爽,一直水题一直爽(比赛全是打铁场) 题意: 有n个例子,统计颜色出现个数。自然联想到map来映射统计(顺便就当写下map用法) 完整代码:注意一下C++提交可能不能通过要G++才行 阅读全文
posted @ 2019-07-16 16:01
Tianwell
阅读(125)
评论(0)
推荐(0)
摘要:
突然发现刷水题魔摸鱼好开心... 题意: 给出一个字符串s,然后对子串进行如下统计 例如:输出连续子串的字母以及个数 思路: 用两个数组来统计,一个统计个数,一个统计字符 Sample Input 2 ABC ABBCCC Sample Output ABC A2B3C 完整代码: #include 阅读全文
posted @ 2019-07-16 15:53
Tianwell
阅读(254)
评论(0)
推荐(0)
摘要:
Input The input consists of a number of cases. Each case starts with a line specifying the integers n and m. The next m lines each consists of two int 阅读全文
posted @ 2019-07-16 15:15
Tianwell
阅读(122)
评论(0)
推荐(0)
摘要:
输入输出格式: input * Line 1: A single integer, P * Lines 2..P+1: Each of these lines describes a legal operation. Line 2 describes the first operation, etc 阅读全文
posted @ 2019-07-16 15:07
Tianwell
阅读(135)
评论(0)
推荐(0)
摘要:
Input The first line contains two integers N and d (1 <= N <= 1001, 0 <= d <= 20000). Here N is the number of computers, which are numbered from 1 to 阅读全文
posted @ 2019-07-16 14:51
Tianwell
阅读(129)
评论(0)
推荐(0)