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 ...
随机推荐
- NSArray的排序问题
1.关于NSArray的排序问题,首先想到的是不是冒泡排序,插入排序....... oc中的NSArray有一种更简单的方式: 例如: NSArray *stringArray=[NSArray ar ...
- Linux入门学习教程:虚拟机体验之KVM篇
本文中可以学习到的命令: 1. aptitude 是apt-get 不会产生垃圾的版本 2. dpkg -L virtualbox 显示属于该包的文件 lsmod | grep kvmfi ...
- LVS负载均衡中arp_ignore和arp_annonuce参数配置的含义
先简单的介绍下关于LVS负载均衡 LVS(Linux Virtual Server)Linux服务器集群系统 针对高可伸缩,高可用服务的需求,给予IP层和内容请求分发的负载均衡调度解决方法,并在Li ...
- s7-300 第二讲
- Android BuildConfig.DEBUG的妙用
在Android开发中,我们使用android.util.Log来打印日志,方便我们的开发调试.但是这些代码不想在发布后执行,我们并不想在软件发布后调试日志被其他开发者看到,现在我的方法是设置一个全局 ...
- ios中关于UIImagePickerController的一些知识总结
记得添加MobileCoreServices.framework 及导入#import <MobileCoreServices/MobileCoreServices.h> @interfa ...
- 【搜索 回溯】 zoj 1002
题意:一些机枪彼此不能在同一行和同一列,但是由于有墙的阻隔,能保证子弹无法穿透,即可以同行同列,现问如果说给了一个n*n(n<=4)的矩阵,并给出了墙的分布情况,能否求出最大能繁殖的机枪数. 思 ...
- HDU 1495 非常可乐 BFS
题目大意:中文题不说了. 题目思路:我有同学用GCD数论写出来的代码很简洁,但是很抱歉,数论蒟蒻,我觉得比赛的时候我没办法推出.如果用BFS的话思路很简单的,就是6方向广搜,只不过稍微麻烦点.具体看代 ...
- phpStudy环境配置多个站点,绑定域名
经常做网站的朋友,往往要在自已的电脑同时建立多个站点,而phpstudy这款软件就能很好的解决这个问题,大家看下图 点击上图中的 其它选项菜单 ,就会弹出下面的对话框,然后点击 站点域名管理 然 后在 ...
- 查看log的方法
adb logcat>1.txt adb shell cat /proc/atf_log/atf_log > atf_log 会保存在adb的本地文件. 还有一种是实时读取的方式: adb ...