Codeforces Round #347 (Div. 2) B. Rebus】的更多相关文章

题目链接: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/B 题意: 给你一个等式,把等式左边的问号用1到n(n为等式右边的数)的数填好,使得等式成立 题解: 贪心求出最小最大值,如果n在这个范围则有解,否则无解. 构造解: 取最小值或最大值,然后从第一个数开始调整,直到等式成立为止. 代码: #include<iostream> #include<cstring> #include<vector> using namespace…
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])…
题目链接: 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…
题目链接: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…
A: 题意:找到[a, b]的最大公约数: 思路:相同时为本身,不同时为1. 套路:碰到水题别想太多: 猜想:两个相邻数,必有一奇一偶,如果偶数有因子3或者其他,奇数可不可能有相同的呢? 枚举一些数后发现没有,出现的奇数全是素数. #include <iostream> #include <algorithm> #include <stdlib.h> #include <time.h> #include <cmath> #include <…
思路:从后往前一位一位的模拟,每次判断一下当前枚举的数是否之间枚举过了.或者当前枚举数过小,小于1989. #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<m…
Description Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor GCD(a, b), for ex…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…