Gym - 101102B】的更多相关文章

题目链接 用火柴棍拼出最大的数,思维题,最后发现暴力1e7刚刚不会超时. #include <bits/stdc++.h> using namespace std; ]={,,,,,,,,,}; int main() { int t; scanf("%d",&t); while(t--) { int len; ]; scanf("%d%s",&len,c); ; ;i<len;i++) sum+=a[c[i]-']; ;i<l…
这个题目的做法不止一种,solve1:每个数字使用的火柴棒都在2~7之间,而且是连续的,就是2-7之前没有空着的数.这样就有一个结论,在下界为l,上界为r的情况下,假设有n个数,那么火柴棒总数一定在n*l 与n*r之间,首先容易想到这个问题肯定是只关心火柴棒的总数,然后就是一个重新组合的问题,假设第一个重组后的数消耗了x个火柴棒,那么剩下的sum-x如果在(n-1)*l 与 (n-1)*r之间,那么一定可以组合成n-1个数,且最后正好用光,条件是数字必须连续,为什么读者可以自己举样例. 这样从9…
B. The Little Match Girl time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Using at most 7 matchsticks, you can draw any of the 10 digits as in the following picture: The picture shows how ma…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an array A of integers of size N, and Q queries. For each query, you will be given a set of distinct integers S and two integers L and R that represent a…
题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury of Berland regional olympiad in informatics does not trust to contest management systems, so the Berland regional programming contest is judged by th…
题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT manager Linus Gates announced his next proprietary open-source system "Winux 10.04 LTS" In this system command "dir -C" prints list of all…