题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99-98),三位的有2099-3098(099-098),四位的有3099-13098(3099-3098) 所以关键字长度一样的会连续出现,1989+0代表一位的开始,1989+10代表两位的开始,1989+10+100代表三位的开始, 现在给你一个长度为len的标志,就可以找出该数位的起始位置198…
思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<m…
题目传送门 /* DFS: 排序后一个一个出发往后找,找到>r为止,比赛写了return : */ #include <cstdio> #include <iostream> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <queue> #include…
unrating的一场CF A - Complicated GCD #include <bits/stdc++.h> const int N = 1e5 + 5; char a[105], b[105]; bool equal() { int lena = strlen (a); int lenb = strlen (b); if (lena != lenb) { return false; } for (int i=0; i<lena; ++i) { if (a[i] != b[i])…
B. Preparing Olympiad Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/B Description You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for…
题目链接: http://codeforces.com/contest/664/problem/B 题意: 给你一个等式,把等式左边的问号用1到n(n为等式右边的数)的数填好,使得等式成立 题解: 贪心求出最小最大值,如果n在这个范围则有解,否则无解. 构造解: 取最小值或最大值,然后从第一个数开始调整,直到等式成立为止. 代码: #include<iostream> #include<cstring> #include<vector> using namespace…
A. Fraction 题目链接:http://codeforces.com/contest/854/problem/A 题目意思:给出一个数n,求两个数a+b=n,且a/b不可约分,如果存在多组满足条件的a和b,输出a/b最大的a和b. 题目思路:首先a+b=n,那么暴力枚举i和n-i,且gcd(i,n-i)==1,由于i越大是n-i越小,则a/b的值越大. 代码: //Author: xiaowuga #include <bits/stdc++.h> using namespace std…
D. Jury Meeting time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet toge…
题目链接:http://codeforces.com/contest/664/problem/B B. Rebus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks,…
题目链接:http://codeforces.com/contest/664/problem/A A. Complicated GCD time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Greatest common divisor GCD(a, b) of two positive integers a and b is equ…