hdu 1409
来源:互联网 发布:php ture还是true 编辑:程序博客网 时间:2024/05/23 19:15
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1409
思路:就是把所有的不符点条件都排除掉,如果都符合,就Yes,否则,No;
View Code
1 #include<cstdio> 2 #include<cstring> 3 4 int main(){ 5 int _case; 6 scanf("%d",&_case); 7 getchar(); 8 while(_case--){ 9 char str[110];10 gets(str);11 int cnt1,cnt2,p,len=strlen(str);12 cnt1=cnt2=p=0;13 bool flag=true;14 for(int i=0;i<len;i++){15 if((str[i]<'0'||str[i]>'9')&&str[i]!='.'&&str[i]!='E'&&str[i]!='-'){16 flag=false;break;17 }else if(str[i]=='E'){18 cnt1++;19 if(i==0||(i+1)==len||cnt1>1){20 flag=false;break;21 }22 }else if(str[i]=='-'){23 cnt2++;24 if(i==0||str[i-1]!='E'||(i+1)==len||cnt2>1){25 flag=false;break;26 }27 }else if(str[i]=='.'){28 p++;29 if((i+1)==len||i==0||p>1||cnt1>0){30 flag=false;break;31 }32 }33 }34 flag?puts("YES"):puts("NO");35 }36 return 0;37 }
0 0
- hdu 1409
- hdu 1409 直译
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- hdu
- 黑色毛衣
- fzu校赛B题
- hdu 1496(hash经典)
- hdu 1270
- cf1b(字符串)
- hdu 1409
- hdu 1571(模拟)
- hdu 1497(图书管理系统模拟)
- “CreateRiaClientFilesTask”任务意外失败。 未能加载文件程序集“System.ComponentModel.DataAnnotations 处理办法
- Qt学习——堆栈窗体QStackedWidget类
- hdu 1707(memset妙用)
- hdu 1572(dfs+最短路)
- hdu 1735(贪心)
- cf3b(贪心)