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…
http://codeforces.com/contest/510/status/B 题目大意 给一个n*m  找有没有相同字母连起来的矩形串 第一种并查集 瞎搞一下 第一次的时候把val开成字符串了 所以wa 改了AC #include<cstdio> #include<map> //#include<bits/stdc++.h> #include<vector> #include<stack> #include<iostream>…
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…
B. Spider Man time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…