UVA12013
2016-07-30 19:40
183 查看
老夫看着模板过的第一道题。。。这类题好蠢,,,只要你有一个老司机的眼神。。。
#include <stdio.h> #include <string.h> const int N = 30; int t, next , vis , num ; char str ; bool judge() { for(int i=2;i<=26;i+=2){ if(num[i]%2)return false; } return true; } int main() { scanf("%d",&t); while(t--){ memset(vis,0,sizeof(vis)); memset(num,0,sizeof(num)); scanf("%s",str); for(int i=0;i<26;i++){ next[i]=str[i]-'A'; } for(int i=0;i<26;i++){ int cnt=1; if(!vis[i]){ vis[i]=1; int k=next[i]; while(!vis[k]){ vis[k]=1; k=next[k]; cnt++; } } num[cnt]++; } printf("%s\n",judge()?"Yes":"No"); } return 0; }
相关文章推荐
- 简单的四则运算
- 数的奇偶性
- ACMer博客瀑布流分析
- ACM程序设计大赛题目分类
- 2015年acm国内排名
- 计算字符串最后一个单词长度
- ACM网址
- 1272 小希的迷宫
- 1272 小希的迷宫
- hdu 1250 大数相加并用数组储存
- 矩阵的乘法操作
- 1.10055 - Hashmat the brave warrior
- 2.10071 - Back to High School Physics
- 3.458 - The Decoder
- 4.694 - The Collatz Sequence
- 6.494 - Kindergarten Counting Game
- 7.490 - Rotating Sentences
- 8.414 - Machined Surfaces
- 9.488 - Triangle Wave
- A.457 - Linear Cellular Automata