Links: http://acm.hdu.edu.cn/showproblem.php?pid=2024
Since the request of all the students to brush the Hangzhou electric 100, then I still set an example, but also to brush the end of it ~ ~ ~
These water problems really are almost brush spit, do not know how many brush off as a search for gaps
But also really found an interesting topic, the ordinary way to judge is really too troublesome, really a physical work
Haven't noticed that these library functions have been used to find such brevity.
Getline ();
Getline () function use detailed
Header file C++<cctype> (C language <ctype.h>)
Isalpha
int isalpha (int ch)
Function: Determine if the character ch is an English letter
NOTE: If CH is an English letter, return non 0 (lowercase letter is 2, capital letter is 1). Returns 0 if it is not a letter.
Isalnum
int isalnum (int c);
Function: Determine if the character variable C is a letter or a numeric description: When C is a number 0-9 or letter A-Z and a-Z, returns a value other than 0, otherwise returns zero.
Code:
1 //I'm too lazy to change it again.2 #define_crt_sbcure_no_deprecate3#include <Set>4#include <map>5#include <cmath>6#include <queue>7#include <stack>8#include <vector>9#include <string>Ten#include <cstdio> One#include <cstdlib> A#include <cstring> -#include <iostream> -#include <algorithm> the#include <functional> -#include <cctype> - - using namespacestd; + - #definell Long Long + #defineMax3 (a,b,c) Fmax (A,fmax (b,c)) A #defineiOS Ios_base::sync_with_stdio (false); Cin.tie (0); Cout.tie (0); at - Const intMAXN = the; - Const intINF =0x3f3f3f3f; - - BOOLcmpConst int&a,Const int&b) - { in returnA>b; - } to + - intMain () the { * intN; $scanf"%d",&n);Panax Notoginseng GetChar (); - while(n--) the { + strings; A getline (cin,s); the //cout << s << endl; + intFlag =1; - if(Isalpha (s[0]) || s[0] =='_') $ { $ for(inti =0; i < s.size (); i++) - { - if(Isalnum (s[i]) = =0&& S[i]! ='_') the { -Flag =0;Wuyi //cout << "$" << Endl; the //continue; - Break; Wu } - } About } $ Else - { -Flag =0; - } A if(flag) +printf"yes\n"); the Else -printf"no\n"); $ the } the the return 0; the}
"STL" "HDU2024" C language Legal identifier "water problem"