CodeForces 662D International Olympiad

写出前几个找规律,然后直接输出。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; int n;
char s[]; int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%s",s); int len=strlen(s);
len=len-;
long long x=; for(int i=;s[i];i++) x=x*+s[i]-'';
if(len==)
{
if(x==) printf("1989\n");
else printf("199%d\n",x);
}
if(len==)
{
if(x==) printf("1999\n");
else printf("20%02d\n",x);
}
if(len==)
{
if(x<=) printf("3%03d\n",x);
else printf("2%03d\n",x);
}
if(len==)
{
if(x<=) printf("1%04d\n",x);
else printf("%04d\n",x);
}
if(len==)
{
if(x<=) printf("1%05d\n",x);
else printf("%05d\n",x);
}
if(len==)
{
if(x<=) printf("1%06d\n",x);
else printf("%06d\n",x);
}
if(len==)
{
if(x<=) printf("1%07d\n",x);
else printf("%07d\n",x);
}
if(len==)
{
if(x<=) printf("1%08d\n",x);
else printf("%08d\n",x);
}
if(len==)
{
if(x<=) printf("1%09d\n",x);
else printf("%09d\n",x);
}
}
return ;
}
CodeForces 662D International Olympiad的更多相关文章
- Codeforces 662D International Olympiad【贪心】
比赛的时候后缀长度在4位以内的时候分类讨论了一下,其实他们完全是一个套路的..并不需要讨论. 然后没有考虑前导0的情况,就wa了.. 题目链接: http://codeforces.com/probl ...
- codeforces 664C C. International Olympiad(数学)
题目链接: C. International Olympiad time limit per test 1 second memory limit per test 256 megabytes inp ...
- 【23.33%】【codeforces 664C】International Olympiad
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Codeforces Round #347 (Div. 2) C. International Olympiad 找规律
题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...
- codeforces Round #347 (Div. 2) C - International Olympiad
思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> ...
- codeforces B - Preparing Olympiad(dfs或者状态压缩枚举)
B. Preparing Olympiad You have n problems. You have estimated the difficulty of the i-th one as inte ...
- Codeforces 730I:Olympiad in Programming and Sports(最小费用流)
http://codeforces.com/problemset/problem/730/I 题意:有n个人参加两种比赛,其中每个人有两个参加比赛的属性,如果参加了其中的一个比赛,那么不能参加另一个比 ...
- CodeForces 550B Preparing Olympiad(DFS回溯+暴力枚举)
[题目链接]:click here~~ [题目大意] 一组题目的数目(n<=15),每一个题目有对应的难度,问你选择一定的题目(大于r个且小于l个)且选择后的题目里最小难度与最大难度差不小于x, ...
- Codeforces Round #384 (Div. 2) A. Vladik and flights 水题
A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive pr ...
随机推荐
- 判断数字 字母 isDigit(), isalpha()
判断是否是数字 isdigit isNumber 二者区别http://www.cnblogs.com/xiashengwang/p/3219925.html 需要包含头文件 #i ...
- 前端 MVC 变形记
背景: MVC是一种架构设计模式,它通过关注点分离鼓励改进应用程序组织.在过去,MVC被大量用于构建桌面和服务器端应用程序,如今Web应用程序的开 发已经越来越向传统应用软件开发靠拢,Web和应用之间 ...
- yum no key
http://serverfault.com/questions/525958/redhat-yum-install-gpg-key-retrieval-failed
- 8.4 sikuli 集成进eclipse 报错:Unsupported major.minor version 51.0
8.3中的问题Win32Util.dll: Can't load 32-bit .dll on a AMD 64 bit platform 解决之后,执行还是会有报错:Unsupported maj ...
- HDU 4027 <线段树,区间√>
题目连接 题意 给出一个区间,每次把[l,r]内的值√,维护区间和. 坑: £:l会比r大,swap. £: 当f[i].sum=f[i].r-f[i].l+1;,不修改.因为保证每个数都大于等于1, ...
- Android简单逐帧动画Frame的实现(三)
android之动画(三)通过AnimationDrawable控制逐帧动画 android与逐帧动画: 效果图: 当我们点击按钮时,该图片会不停的旋转,当再次点击按钮时,会停止在当前的状态. ...
- 关于html5的几个新标签在IE9之前不支持的解决办法
IE8及之前的浏览器不支持用CSS的方法来使用这些尚未支持的结构元素,为了在Internet Explorer浏览器中也能正常使用这些结构元素,需要使用JavaScript脚本,如下:<scri ...
- CodeForces--TechnoCup--2016.10.15--ProblemA--Transformation: from A to B
http://codeforces.com/contest/727/problem/A Transformation: from A to B time limit per test 1 second ...
- hdu 1560 DNA sequence(迭代加深搜索)
DNA sequence Time Limit : 15000/5000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total ...
- 转:Selenium Grid+JAVA +Windows 配置(Selenium 2.0)
Selenium-Grid 允许你在多台机器的多个浏览器上并行的进行测试,也就是说,你可以同时运行多个测试.本质上来说就是,Selenium-Grid 支持分布式的测试执行.它可以让你的测试在一个分布 ...