题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5919 题意: 给出正整数 $N(1 \le N \le 10^5)$,询问对于正整数 $k$,有多少个小于 $2^N$ 的 $2^k-1$ 是 $7$ 的整数倍. 题解: $…
题目 链接 题意:给出x数列的定义: $T_0 = a$ $T_1 = b$ $T_n = T_{n-2} \bigoplus T_{n-1} $ 求第 $n$ 项( $0 \leqslant a,b,c \leqslant 10^{18} $) 分析 $n$ 这么大,肯定是常数时间复杂度. 打表找规律,能发现循环节为3. 或者直接推导,$a \bigoplus b = c, \ b \bigoplus c = a, \ c \bigoplus a = b$ #include<bits/stdc…
传送门 题意: 给出了三个新定义: E-prime : ∀ num ∈ E,不存在两个偶数a,b,使得 num=a*b;(简言之,num的一对因子不能全为偶数) E-prime factorization : 定义集合P由 E-prime 元素组成,定义 e = p1*p2*.....*pn:(p1,p2,....,pn ∈ P , |P| = n) E-factorial : 定义 e!! = 2*4*6*8*.........*e:(简言之,偶数e及其之前的偶数连乘积) 输出一个数 e ,求…
A. Little Pony and Expected Maximum Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/453/problem/A Description Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing.…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
CODE FESTIVAL 2017 qual B B - Problem Set 确实水题,但当时没想到map,用sort后逐个比较解决的,感觉麻烦些,虽然效率高很多.map确实好写点. 用map: #include<iostream> #include<cstdio> #include<cstdlib> #include<map> using namespace std; map<int,int>mp; int main() { int n,…
2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transformation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 85 Accepted Submission(s): 31 Problem Descr…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1005 Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 198316    Accepted Submission(s): 49744 Problem Description A number sequence…
Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued. You are to w…
I was trying to solve problem '1234 - Harmonic Number', I wrote the following code long long H( int n ) {    long long res = 0;    for( int i = 1; i <= n; i++ )        res = res + n / i;    return res;} Yes, my error was that I was using the integer…
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…
版权声明:本文为博主原创文章,未经博主同意不得转载. vasttian https://blog.csdn.net/u012860063/article/details/36905379 转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 找规律,前两个数的和等于后一个数的值. 事实上就是大菲波数: 代码例如以下: #include <cstdio> #include <cstring> #include <io…
http://www.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - 1) +f(n - 2) 求f(n) 思路:给出了递推式就是水题. /** @Date : 2016-12-17-15.54 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : *…
Another Rock-Paper-Scissors Problem 题目连接: http://codeforces.com/gym/100015/attachments Description Sonny uses a very peculiar pattern when it comes to playing rock-paper-scissors. He likes to vary his moves so that his opponent can't beat him with hi…
Problem E: Su-Su-Sudoku/center> 题目连接: http://codeforces.com/gym/100646/attachments Description By now, everyone has played Sudoku: you're given a 9-by-9 grid of boxes which you are to fill in with the digits 1 through 9 so that 1) every row has all n…
http://lightoj.com/volume_showproblem.php?problem=1245 G - Harmonic Number (II) Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1245 Description I was trying to solve problem '1234 - Harmonic…
/** 题目:Joseph's Problem 链接:https://vjudge.net/problem/UVA-1363 题意:给定n,k;求k%[1,n]的和. 思路: 没想出来,看了lrj的想法才明白. 我一开始往素数筛那种类似做法想. 想k%[1,n]的结果会有很多重复的,来想办法优化. 但没走通. 果然要往深处想. 通过观察数据发现有等差数列.直接观察很难确定具体规律:此处应该想到用式子往这个方向推导试一试. lrj想法: 设:p = k/i; 则:k%i = k-i*p; 容易想到…
题意:给定一个n*m的矩阵,问你里面有几面积为奇数的正方形. 析:首先能知道的是,大的矩阵是包括小的矩阵的,而且面积为奇数,我们只要考虑恰好在边界上的正方形即可,画几个看看就知道了,如果是3*3的有3个, 5*5有5个,偶数没有,因为面积为奇数.那么结果就有了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #in…
题意:给定一个n,求前 n 个正整数,正奇数,正偶数之和. 析:没什么好说的,用前 n 项和公式即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include…
找到规律模拟就可以了,用DFS模拟很简洁,用循环模拟比较直观(大概吧) 注意输入输出用%llu,1ULL<<64=0!被这几个小问题卡了好久 #include <cstdio> #include <algorithm> #include <cstring> using namespace std; int T; unsigned long long n,p,q; unsigned long long path; int lev; int main() { s…
链接:传送门 题意:略 思路:f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7 -> f(n) = (A * f(n-1)%7 + B * f(n-1)%7)%7 检查输出可以发现规律,每48个数一循环,因此只需要打出前50个数的fib表然后对n%7即可. /************************************************************************* > File Name: 1.cpp > Aut…
Problem J. Joke 题目连接: http://codeforces.com/gym/100714 Description The problem is to cut the largest possible number of circles with diameter y out of a stripe of length x and width y. Input The only line of input consists of two positive real number…
Problem H. Hometask 题目连接: http://codeforces.com/gym/100714 Description Kolya is still trying to pass a test on Numbers Theory. The lecturer is so desperate about Kolya's knowledge that she gives him the same task every time. The problem is to check i…
Problem C. Contest 题目连接: http://codeforces.com/gym/100714 Description The second round of the annual student collegiate programming contest is being held in city N. To be prepared for the inrush of participants, the jury needs to know the number of t…
杭电1002http://acm.hdu.edu.cn/showproblem.php?pid=1022 Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25276    Accepted Submission(s): 9529 Problem Description As the new term com…
The Number Off of FFF Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 78    Accepted Submission(s): 36 Problem Description X soldiers from the famous "*FFF* army" is standing in a line, fro…
题意: 给一个序列,要找一个等差或等比的连续子序列,求其最长的长度. 思路: 扫两遍,判断等差或等比即可.从左往右扫,维护一个滑动窗口,考虑新加进来的数,如果满足了要求,则更新长度,否则只留最后两个数字,其他删掉,接着继续考虑下一个数字.等比也是如此,只是要注意精度的问题. 别人的代码: #include <bits/stdc++.h> using namespace std; ; int arr[MAX]; int main(void) { //freopen("in.txt&qu…
A problem of sorting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=627&pid=1001 Description 给出一张许多人的年龄和生日表.你需要从年轻到年老输出人们的名字.(没有人年龄相同) Input 第一行包含一个正整数T(T \leq 5)T(T≤5),表示数据组数. 对于每组数据,第…
Por Costel and Azerah Descriptions 给你n个数 问你,有多少个子序列 的和是偶数 Example Input 233 10 124 2 Output 33 题目链接 https://vjudge.net/problem/Gym-100923A   恶心死了   freopen("azerah.in","r",stdin); freopen("azerah.out","w",stdout); 必…
A Simple Math Problem Lele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + -- + a9 * f(x-10);And ai(0<=i<=9) can only be 0 or 1 .Now, I will give a0 ~ a9 and two posit…