上一页 1 ··· 15 16 17 18 19
摘要: 题意:T个例子,n堆,然后对应 堆的个数 a, b c .... 还是alice先拿再bob ,游戏规则相对Nim博弈有些不一样。这次是将每堆分成两堆,且所分堆的个数必须大于等于1 . 问谁能赢; 思路:根据sg函数结论求值 1.最终局面sg值为0则先手必输 2.所有子游戏的sg值异或后等于原游戏的 阅读全文
posted @ 2019-07-16 17:15 Tianwell 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题意: 给出一个很大的数字(很长的字符串),然后将其位数相加 如果大于10则继续相加 直到结果小于10,输出结果 思路: 用string来记录不定长的字符串,然后将其用while()循环处理 阅读全文
posted @ 2019-07-16 16:08 Tianwell 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 一时水题一时爽,一直水题一直爽(比赛全是打铁场) 题意: 有n个例子,统计颜色出现个数。自然联想到map来映射统计(顺便就当写下map用法) 完整代码:注意一下C++提交可能不能通过要G++才行 阅读全文
posted @ 2019-07-16 16:01 Tianwell 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 突然发现刷水题魔摸鱼好开心... 题意: 给出一个字符串s,然后对子串进行如下统计 例如:输出连续子串的字母以及个数 思路: 用两个数组来统计,一个统计个数,一个统计字符 Sample Input 2 ABC ABBCCC Sample Output ABC A2B3C 完整代码: #include 阅读全文
posted @ 2019-07-16 15:53 Tianwell 阅读(243) 评论(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 阅读(109) 评论(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 阅读(130) 评论(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 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题意:给出两个很大的数A,B求和(这里最大位数为1000) 思路:对于很大的数相加,就不能往开int数据类型大小了,试着用char[]或者int[]来存储数位。然后将每一位相加,大于10则进位 完整代码: 阅读全文
posted @ 2019-07-15 16:38 Tianwell 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题意:已知某昆虫有雄雌两性,然后给出案例数t, 对应每一个案例中给出编号数目和关系数目n,m ,在接下来m行中给出对应关系为异性的a b,最后判断所给中关系中是否有冲突部分 思路:关于种类并查集,有两种思路 (1) 开对应集合数量倍空间,类似POJ-1703也是两个互斥关系的集合: 有n个成员,开两 阅读全文
posted @ 2019-07-13 16:18 Tianwell 阅读(152) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19