Timus - 1213 - Cockroaches!】的更多相关文章

先上题目: 1213. Cockroaches! Time limit: 1.0 secondMemory limit: 64 MB It's well-known that the most tenacious of life species on the Earth are cockroaches. They live everywhere if only there in food. And as far as they are unpretentious in food you can…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1213 #include <stdio.h> int cases, caseno; int n, K, MOD; int A[1001]; int main() { scanf("%d", &cases); while( cases-- ) { scanf("%d %d %d", &n, &K, &MOD); i…
Description Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of two colors: black and red. There are n cockroaches living in Anatoly's room. An…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213 有关系(直接或间接均可)的人就坐在一张桌子,我们要统计的是最少需要的桌子数. 并查集的入门题,什么优化都无用到就可以直接过.实质上就是统计总共有多少个不相交的集合.比较可恶的是,题目中 There will be a blank line between two cases 是骗人的!!! #include <iostream> using namespace std; + ; int p[…
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1997 这个星球上有两种人,一种进酒吧至少玩a小时,另一种进酒吧最多玩b小时. 下面n行是人进进出出的时刻,0为进,1为出.让你求是否有合法解. 将合法的进入和出去连边,然后二分匹配就可以了. #include <iostream> #include <cstring> #include <cstdio> #include <vector> #inc…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213 简单并查集,统计单独成树的数量. 代码: #include <stdio.h> #include <string.h> #include <math.h> #include <limits.h> #include <algorithm> #include <iostream> #include <ctype.h> #in…
B. Anatoly and Cockroaches time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there tog…
原题链接:http://acm.timus.ru/problem.aspx?space=1&num=1006 看到题第一反应:这玩意怎么读入…… 本地的话因为是全角字符,会占两个位置,所以需要使用两个getchar()(反正我的IDE会这样),而提交上去getchar是可以读入218,191这样的ASCII码值的. 主程序段就不用说了,随便暴力跑跑就好. 然后是几个坑点: “Your sequence does not have to be the same with the original…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1213 Problem Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the fri…
http://acm.timus.ru/problem.aspx?space=1&num=1132 题意: 求 x^2 ≡ n mod p  p是质数 的 解 本题中n>=1 特判p=2,接下来求当p是奇素数时的解 引理1: 引理2:方程有解当且仅当 定理: 设a满足 不是模p的二次剩余, 即无解, 那么是二次剩余方程的解 #include<cstdio> #include<cstdlib> #include<algorithm> using namesp…