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 ...
随机推荐
- springsecurity源码查看网址
http://www.boyunjian.com/javasrc/org.springframework.security/spring-security-web/3.1.3.RELEASE/_/or ...
- Linux 配置脚本 启动服务
之前在mac安装了php和nginx每次都用一堆命令重启 今天没事情干,心血来潮,自己研究写了一段shell脚本来重启 首先vim /usr/sbin/pn 代码如下 #! /bin/bash php ...
- linux查看文件及文件夹的大小
最近发现服务器的磁盘容量使用率超过了90%,所以有必要查看是哪个文件占用了太多的空间, 服务器系统:CentOS6.5 df -h #查看磁盘使用情况,步骤1 cd / #切换到根目录, 步骤2 du ...
- psy
本文的重点是讲解如何运用心理线指标看盘,运用周线月线的心理线来抓住大盘的顶部和底部的研究.分析研究的材料都来源于沪市历史上的顶部和底部的历史数据.从psy数据所得出的结论大多数是有效的,只有个别时期的 ...
- Qt之日志输出窗口
来源:http://blog.sina.com.cn/s/blog_a6fb6cc90101guz0.html 继上节所讲,Qt可以很容易的将一些日志信息保存到文件中,那么日志信息如何输出到窗口呢? ...
- 移植 wifi模块
本文以realtek 8192CU WiFi模块为例,介绍USB wifi在Jelly Bean 4.1的调试笔记. 1.WIFI打不开现象概述 WiFi打不开是指您在UI的settings下选中Wi ...
- linux cat more less head tail
cat 命令: cat filename 查看一个文件的内容cat[选项][文件]... -b 对非空白行进行编号,行号从1开始-n 和nl命令差不多,对所有行(包括空白行)进行编号输出显示-E ...
- runtime基础知识
看到一篇不错的runtime方面博客: 引言 相信很多同学都听过运行时,但是我相信还是有很多同学不了解什么是运行时,到底在项目开发中怎么用?什么时候适合使用?想想我们的项目中,到底在哪里使用过运行时呢 ...
- UITableView的子控件高度不确定处理
比如,tableView的tableFootView的控件数量是根据网络请求的数据而定的.那么tableView并不能准确的设置其contentSize.处理方法: 在tableFootView的类中 ...
- FRP 浅析
一.Reactive? 请先看一个非常简单的小应用,它允许用户在一个搜索输入框里输入关键词,然后在其下方的结果区域实时显示从Flicker网站搜索得到的图片,当用户输入的关键词发生变化,显示的图片也会 ...