摘要: 这题的话,我们首先对于移动函数可以知道,因为只是顺逆的关系,也就是加一或者减一,所以我们每次移动的时候,都补上一个小于n的最大整数,然后取模,这样就不会有负数,而且加之后的结果不会超过2*n,所以我们取模的结果就是0到n-1,然后加上1就可以得到原位置了。题目中的逆时... 阅读全文
posted @ 2018-12-26 21:51 xyee 阅读(129) 评论(0) 推荐(0) 编辑
摘要: #include char ans[1000],gus[1000];int num[10];int main(){ int n,cnt=1; while (scanf("%d",&n)==1&&n) { printf("Game %d:\n",cnt++); fo... 阅读全文
posted @ 2018-12-26 20:56 xyee 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 这题的话,字符串序列是循环的,我们对于for循环来讲,就不能再只看做下标了,我们把i的增加看做是计数,这样子就类似于一个偏移量了。然后从字符串的头到尾,我们每次偏移相同的大小,即字符串的长度(也是最大长度),用来比较究竟是以哪一个开头,字符串字典序最小。#includ... 阅读全文
posted @ 2018-12-26 20:35 xyee 阅读(100) 评论(0) 推荐(0) 编辑
摘要: #include #include int main(){ char s[100]; int T; scanf("%d",&T); while (T--) { scanf("%s",s); int len=strlen(s); int cnt=0,score=0... 阅读全文
posted @ 2018-12-26 20:29 xyee 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 这是一道字符串的题目,我们直接对字符串进行解析,然后计算就可以了。我是直接开了两个数组存入对应的值,没有进行判断,我们如果在if判断里面直接增加了i的值,最好先把对应的字符存起来,然后这样才不容易出错。#include #include #include char s... 阅读全文
posted @ 2018-12-26 20:27 xyee 阅读(180) 评论(0) 推荐(0) 编辑