您的位置:首页 > 其它

杭电2024题

2016-04-21 18:48 92 查看
#include<iostream>#include<string>using namespace std;int main(){ int n; while (cin >> n&&n) { getchar(); for (int i = 1; i <= n; i++) {char a[50]; cin.getline(a, 50); int count=0,sum=0,count1=0,count2=0,count3=0,count4=0; for (int j = 0; j < strlen(a); j++) { if ('0' <= a[0] && a[0] <= '9'){ count = 0; break; } if (a[j] == ' ') { count = 0; break; } if (('0' <= a[j] && a[j] <= '9')) count1++; if (('a' <= a[j] && a[j] <= 'z'))count2++; if (('A' <= a[j] && a[j] <= 'Z'))count3++; if ((a[j] == '_'))count4++; count = count1 + count2 + count3 + count4; }if (count== strlen(a)) cout << "yes" << endl; else cout << "no" << endl; } }return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: