ZOJ 3939 The Lucky Week (暴力找规律)】的更多相关文章

题意:给定一个幸运日,求第 k 个幸运日是多少. 析:由于闰年,每400肯定会循环一次,所以我们就可以先找出每400年会有多少幸运日,是2058个,然后再暴力. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #inclu…
A - Magic Number Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3622 Appoint description:   Description A positive number y is called magic number if for every positive integer x it satisfies tha…
Description Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has two str…
小光的忧伤 Time Limit: 2000/1000ms (Java/Others) Problem Description: 锴神:我尊重作者原意,你们出什么我就加什么.于是小光打了道水题(也就是这道),但是呢比赛的时候拿着自己的标程却AC不了,最后只能尴尬地打表!!为毛呢?!请你来看看这道题,为了缓解小光的尴尬,他决定不告诉你样例输入输出,神马?!没有输入输出?对,就是这么贼! Input: 多组数据,输入n,求(1^n+2^n+3^n+4^n)mod 5,其中n范围是[10^5,10^(…
Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Edward suddenly found that if Monday was the 1st, 11th or 21st day of that month, he could remember the date clearly in that week.…
C. No to Palindromes! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of th…
题目大意: 思路:基尔霍夫矩阵求生成树个数,不会. 可是能够暴力打表.(我才不会说我调试force调试了20分钟... CODE(force.cc): #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define MAX 1000 using namespace std; struct Edge{ int x,y; Edge(int _,int __…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4708 思路:由于N不大,并且我们可以发现通过旋转得到的4个对角线的点的位置关系,以及所要旋转的最小步数,然后把所有的符合条件的都加入数组中,最后排序即得. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct No…
这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就可以吃掉所有的.所以first必赢,} else {first无法一口吃掉所有的,所以second成了主动的了,如果first第一口吃掉k1个,那么明智的second只要吃掉k2个就可以了(n-k1-k2是偶数,也包括 0的),使得 剩下的数字是分成两个数字数目相等的堆,以后的工作便是first做什么,那么s…
题意:定义 Fn 序列表示一串 <1 的分数,分数为最简分数,且分母 ≤n .问该序列的个数.(2≤N≤10^6) 解法:先暴力找规律(代码见屏蔽处),发现 Fn 序列的个数就是 Φ(1)~Φ(n) 的和.于是用欧拉筛预处理就好了. 注意--求前缀和要用 long long 的类型. 1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<iostream> 5 usi…