写出前几个找规律,然后直接输出。

#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的更多相关文章

  1. Codeforces 662D International Olympiad【贪心】

    比赛的时候后缀长度在4位以内的时候分类讨论了一下,其实他们完全是一个套路的..并不需要讨论. 然后没有考虑前导0的情况,就wa了.. 题目链接: http://codeforces.com/probl ...

  2. codeforces 664C C. International Olympiad(数学)

    题目链接: C. International Olympiad time limit per test 1 second memory limit per test 256 megabytes inp ...

  3. 【23.33%】【codeforces 664C】International Olympiad

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. Codeforces Round #347 (Div. 2) C. International Olympiad 找规律

    题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...

  5. codeforces Round #347 (Div. 2) C - International Olympiad

    思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> ...

  6. codeforces B - Preparing Olympiad(dfs或者状态压缩枚举)

    B. Preparing Olympiad You have n problems. You have estimated the difficulty of the i-th one as inte ...

  7. Codeforces 730I:Olympiad in Programming and Sports(最小费用流)

    http://codeforces.com/problemset/problem/730/I 题意:有n个人参加两种比赛,其中每个人有两个参加比赛的属性,如果参加了其中的一个比赛,那么不能参加另一个比 ...

  8. CodeForces 550B Preparing Olympiad(DFS回溯+暴力枚举)

    [题目链接]:click here~~ [题目大意] 一组题目的数目(n<=15),每一个题目有对应的难度,问你选择一定的题目(大于r个且小于l个)且选择后的题目里最小难度与最大难度差不小于x, ...

  9. 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 ...

随机推荐

  1. web项目从域名申请到发布

    http://wenku.baidu.com/link?url=H-Hu2nvzFRirdxO3xzrWCWfc4WJFLyFjsxak5MFwOuzQfgTawJLXC4vAc4xYAIySxn59 ...

  2. HDU 2255 奔小康赚大钱 KM算法的简单解释

    KM算法一般用来寻找二分图的最优匹配. 步骤: 1.初始化可行标杆 2.对新加入的点用匈牙利算法进行判断 3.若无法加入新编,修改可行标杆 4.重复2.3操作直到找到相等子图的完全匹配. 各步骤简述: ...

  3. zzuli 1919 数列划分

    题面: Description 晴天想把一个包含n个整数的序列a分成连续的若干段,且和最大的一段的值最小,但他有强迫症,分的段数不能超过m段,然后他就不会分了...他想问你这个分出来的和最大的一段的和 ...

  4. 小蚂蚁搬家<贪心>

    题意: 由于预知未来可能会下雨,所以小蚂蚁决定搬家.它需要将它的所有物品都搬到新家,新家的体积为V,小蚂蚁有N件物品需要搬,每件物品的体积为Ai,但他发现:每件物品需要新家剩余体积大于等于Bi才能使它 ...

  5. RxSwift 之官方文档

    RxSwift 官方文档结构 Introduction: Subjects Transforming Observables Filtering Observables Combining Obser ...

  6. Android自动化测试之环境搭建

    Android自动化测试之环境搭建 一.Android-sdk介绍 SDK(Software development kit)软件开发工具包.被软件开发工程师用于为特定的软件包.软件框架.硬件平台. ...

  7. [原]左右的移动&lt;&lt;&gt;&gt;&lt;&gt;jQuery的实现

    $(function () {             $('#toAllLeft').click(function () {                 $('#se1 option').app ...

  8. HDU 2675 Equation Again

    公式转化+二分答案 首先,把题目中给的等式转化一下,变成了这个样子. 等式右边的值是可以求出来的. ln(x)/x的大致图像是这样的 那么只要对[0,e]和[e,+∞]分别进行二分答案即可. #inc ...

  9. hdu_2544_最短路(spfa版子)

    题目连接:hdu_2544_最短路 存个自己写的SPFA的板子 #include<cstdio> #include<cstring> #define mst(a,b) mems ...

  10. Android AudioPolicyService服务启动过程

    AudioPolicyService是策略的制定者,比如什么时候打开音频接口设备.某种Stream类型的音频对应什么设备等等.而AudioFlinger则是策略的执行者,例如具体如何与音频设备通信,如 ...