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

#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. ubuntu 软件管理

    软件安装管理 安装软件 sudo apt-get install **** 检索软件 sudo apt-cache search **** 更新源 sudo apt-get update   **** ...

  2. JavaScript跨域总结与解决办法 什么是跨域

    什么是跨域 1.document.domain+iframe的设置 2.动态创建script 3.利用iframe和location.hash 4.window.name实现的跨域数据传输 5.使用H ...

  3. asp.net textbox控件readonly为true时,后台取值的问题

    如题,在后台通过textbox.Text方式取值为空,不论你默认值是否是空,如想要获得,需通过request.Form[""]的方式.

  4. 上海赛趣-top.mainFrame.tabAddHandler方法详解

    top.mainFrame.tabAddHandler("item"+Id,'项目:'+itemname,'<%=basePath%>bizitem/goEditIte ...

  5. RS485 介绍

    一.RS485总线介绍: RS485总线是一种常见的串行总线标准,采用平衡发送与差分接收的方式,因此具有抑制共模干扰的能力.在一些要求通信距离为几十米到上千米的时候,RS485总线是一种应用最为广泛的 ...

  6. 由浅到深理解java反射

    1.基础概念 class类: 1.1java是面向对象的,但是在java中存在两种东西不是面向对象的 一种是普通的数据类型,这也是封装数据类存在的原因. 二种是静态静态成员. 1.2所以我们首先要理解 ...

  7. Java R&W Related

    In Java, byte = 8 bit, char = 16 bit In C/C++, char = 8 bit There is difference because Java uses Un ...

  8. 内核添加对yaffs2文件系统的支持

    移植方法: 第一步,我们需要YAFFS2的源码,如果大家有兴趣想了解YAFFS2文件系统的驱动原理的话可以直接去访问他们的官网,地址是www.yaffs2.net,上面说的很详细的,也有源码下载地址, ...

  9. js框架——angular.js

    这是一个前端用的框架,使用简单.详细介绍这里就不写了,主要介绍其语法和作用—— 1. 声明一个angular 如果想要使用一个angular代码,则需要在[想要使用angular的范围内写上ng-ap ...

  10. mouseleave 和 mouseout 区别

    jQuery中的mouseleave和mouseout的区别 $("li").each(function(i) {            //删除的鼠标划过的显示与隐藏       ...