2012百度之星初赛第一场
2012-06-02 11:41
239 查看
这个初赛一共有4道题目,我只有出来B题。不过,也没办法,像我这种新手在两个小时内根本不可能做得完。明天还有一场,争取也能做出一道题目。
我的B题答案:
我的B题答案:
#include <string> #include <iostream> #include <math.h> using namespace std; int main(){ long int x,a,b; int n; cin>>n; while(n--) { cin>>x>>a>>b; if(x>b) cout<<0<<endl; int length1=(int)floor(log10((double)x))+1; int length2=(int)floor(log10((double)a))+1; int length3=(int)floor(log10((double)b))+1; int head1=a/(int)pow(10.0,length1); int head2=b/(int)pow(10.0,length2); int end1=a%(int)pow(10.0,length1); int end2=b%(int)pow(10.0,length2); int cha=head2-head1; if(end1<=x&&end2>=end1) cha++; cout<<cha<<endl; } system("pause"); return 0; }
相关文章推荐
- 2012百度之星初赛第一场题B小小度刷礼品
- 2012百度之星初赛第一场题A度度熊就是要第一个出场
- 【2012 - 百度之星 / 初赛第一场 B:小小度刷礼品】
- 2012百度之星初赛第一场B题
- 2012百度之星初赛第一场B题
- 2014百度之星初赛第一场部分题解
- 2008百度之星第一场初赛题目
- 2012百度之星初赛下 c题
- 51nod 1515 明辨是非 && 2017百度之星初赛第一场第二题(并查集+启发式合并)
- php解:百度之星2009程序设计大赛 初赛第一场试题--------火柴游戏
- hdu 5247 找连续数 && 百度之星初赛第一场1002
- 百度之星2012初赛第二场C, 网页聚类, 二分
- 百度之星2009程序设计大赛 初赛第一场试题
- 2012百度之星初赛第2场c题
- 百度之星2012初赛Day1 A - 度度熊就是要第一个出场
- 【2012百度之星/初赛上】小小度刷礼品
- 百度之星2012初赛Day1 B - 小小度刷礼品
- 百度之星2016初赛第一场(Astar Round 2A)
- 2012百度之星初赛第二场ProblemC
- 2012百度之星初赛第二场A题解答