http://acm.fzu.edu.cn/problem.php?pid=2182
胖哥自从当上公务员,赢取白富美,走向人生巅峰后,已经懒散到不想出题了,不仅如此,他连题目都懒得看了,现在他只会根据题目第一个单词的长度判定这个题目的难度
如果题目的第一个单词太长(长度大于3),他会说这题太难,不可能想的出来; 如果题目的第一个单词太短(长度不大于3),他会说这题太简单,懒得去想
现在给定一个题目,L想知道胖哥对于这道题会作出什么反应
首先是一个正整数cas,表示有cas组输入,cas<=100
对于每组输入,会给出一行,每行表示一个题目,每个题目只会由大写字母,小写字母或者空格构成,每行的第一个字符一定不会是空格,多个空格可能连续出现,每行最多200个字符
对于每个题目,如果胖哥觉得这题太难,输出"Too hard!",否则输出"Too easy!"
1 #include <stdio.h> 2 #include <algorithm> 3 #include <iostream> 4 #include <string.h> 5 #include <string> 6 #include <math.h> 7 #include <stdlib.h> 8 #include <queue> 9 #include <stack> 10 #include <set> 11 #include <map> 12 #include <list> 13 #include <iomanip> 14 #include <vector> 15 #pragma comment(linker, "/STACK:1024000000,1024000000") 16 #pragma warning(disable:4786) 17 18 using namespace std; 19 20 const int INF = 0x3f3f3f3f; 21 const int MAX = 200 + 10; 22 const double eps = 1e-8; 23 const double PI = acos(-1.0); 24 25 char str; 26 int main() 27 { 28 int n; 29 while(~scanf("%d",&n)) 30 { 31 getchar(); 32 int i; 33 for(i = 0;i < n;i ++) 34 { 35 int first = 1 , ans = 0; 36 while(scanf("%c" , &str ) && str != '\n') 37 { 38 if(str != ' ' && first) 39 ans ++; 40 else if(str == ' ') 41 first = 0; 42 } 43 if(ans > 3) 44 cout << "Too hard!" << endl; 45 else 46 cout << "Too easy!" << endl; 47 } 48 } 49 return 0; 50 }
我真二,竟然没有想到用gets(),再来个简单的。
1 #include<stdio.h> 2 #include<string.h> 3 char s[200],a[50]; 4 int main() 5 { 6 int n; 7 scanf("%d",&n); 8 getchar(); 9 while(n--) 10 { 11 scanf("%s",a); 12 gets(s); 13 if(strlen(a)>3) 14 printf("Too hard!\n"); 15 else 16 printf("Too easy!\n"); 17 } 18 return 0; 19 }