HDU(简单题目) 1038 Biker's Trip Odometer 1039 Easier Done Than Said?
2016-06-16 22:36
591 查看
心情不好,找了几个水题
1038 Biker's Trip Odometer
题意难懂,直径 圈数 时间,算总的路程,然而车走的是步数,要化成mile
1039 Easier Done Than Said?
题意:略
思路:略
竟然卡了,题意是连续的几个数是怎么样的,而不是连续的几个数是连续的原音,失误,,
1038 Biker's Trip Odometer
题意难懂,直径 圈数 时间,算总的路程,然而车走的是步数,要化成mile
/* HDU 1038 题意:直径 圈数 时间 思路:算出总路程,然而这个路程是步数,要换算成mile */ #include<iostream> #include<cstdio> using namespace std; const double p = 3.1415927; int main() { double a,b,t,dis,speed; int time=0; while(~scanf("%lf%lf%lf",&a,&b,&t)&&b) { dis=a*b*p; dis/=12*5280; speed=dis*3600/t; printf("Trip #%d: %.2lf %.2lf\n",++time,dis,speed); } return 0; }
1039 Easier Done Than Said?
题意:略
思路:略
竟然卡了,题意是连续的几个数是怎么样的,而不是连续的几个数是连续的原音,失误,,
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; //char s[5]={'a','e','i','o','u'}; bool vowel(char c)//判断是否为原音 { if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') return true; return false; } int main() { char str[25]; while(~scanf("%s",str)&&strcmp("end",str)!=0) { int len=strlen(str); bool flag_vowel=false;//判断是否含有原音 bool consecutive_vowel=true;//判断是否含有连续三个原音或辅音 bool repeat_vowel=true;//判断是否含有连续三个字母 for(int i=0;i<len;i++) { if(vowel(str[i])) { flag_vowel=true; break; } } for(int i=0;i<len-2;i++)//不连续 { if((vowel(str[i])&&vowel(str[i+1])&&vowel(str[i+2])) ||(!vowel(str[i])&&!vowel(str[i+1])&&!vowel(str[i+2]))) consecutive_vowel=false; } for(int i=0;i<len-1;i++) { if(str[i]==str[i+1]) { repeat_vowel=false; if(str[i]=='e'||str[i]=='o')//特殊情况 { repeat_vowel=true; } } } if(flag_vowel&&consecutive_vowel&&repeat_vowel) printf("<%s> is acceptable.\n",str); else printf("<%s> is not acceptable.\n",str); } return 0; }
相关文章推荐
- LeetCode之11_Container With Most Water
- Leetcode 219. Contains Duplicate II
- paint().paintComponent()方法的区别
- RAID各级别特性
- Thumbnailator图像处理
- 通用工具pair
- wait_for_completion_timeout 超时返回0 的问题
- Autolayout 中 NSLayoutConstraint
- POJ 1681---Painter's Problem(高斯消元)
- NSSearchPathForDirectoriesInDomains
- 【MongoDB】2016-06-16T11:00:48.634+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061 由于目标计算机积极拒绝,无法连接。
- Vivado Implementation - ERROR: [Chipscope 16-119] Implementing debug core dbg_hub failed
- APK Tool的问题:Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
- 【BZOJ2434-[Noi2011]】阿狸的打字机(AC自动机(fail树)+离线+树状数组)
- DDD(Domain Driver Designer) 领域驱动设计简介
- POJ 1681 Painter's Problem(高斯消元)
- 关于部分手机通话录音报start failed的问题
- 【leetcode】172. Factorial Trailing Zeroes
- WSASocket failed 10013 处理
- 打开金蝶AIS文件方法