2064. Caterpillars Time limit: 3.0 secondMemory limit: 64 MB Young gardener didn’t visit his garden for a long time, and now it’s not very pleasant there: ncaterpillars have appeared on the ground. Kirill decided to use this opportunity to have some…
codeforces Nikita and string time limit per test 2 seconds memory limit per test 256 megabytes One day Nikita found the string containing letters "a" and "b" only. Nikita thinks that string is beautiful if it can be cut into 3 stri…
题目描述 Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub, managed to get hold of th…
D - AnindilyakwaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/D Description The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: “I've hooked e…
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of lamps in the garland). You have to recolor some lamps in this garland (recoloring a lamp means chang…
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just de…
Nirvana 题目链接(点击) Kurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper. Help Kurt find the maximum possible product of digits among all integers from 11 to nn.…
题目链接:传送门 A. Elections (思维+暴力) 思路: 从最小的k开始枚举就好了- -. #include <bits/stdc++.h> using namespace std; + ; int a[MAX_N]; int main() { int N; cin >> N; , sum = ; ; i <= N; i++) { scanf("%d", a+i); m = max(m, a[i]); sum += a[i]; } int a…
第二章 如何实现应用RSA算法 趁着白天在自家店里的闲暇时间来写写第二章了,假设记住了第一章的各种定理之后,我们又该如何实现RSA密码的加密解密呢?也懒得废话了,直接进入正题吧. 先回顾几个知识点: 1.模运算的性质: 结合律:(a % p * b) % p = (a * b) % p 可知当a == b时,(a % p * a) % p = (a * a) % p 2.欧拉定理 a^φ(n) ≡ 1 (mod n) 3.乘法逆元性质 e * d ≡ 1 (mod n) => e * d ≡ 1…
链接: http://acm.timus.ru/problem.aspx?space=1&num=1010 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26732#problem/E E - Discrete Function Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice …
题目传送门 /* 思维题:注意题目一句话:At some moment it happened so that they shot one and the same can. 如果两个人都有射中的话,肯定一个can同时被打中 */ #include <bits/stdc++.h> using namespace std; int main(void) //URAL 1409 Two Gangsters { int a, b; while (cin >> a >> b)…