上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 36 下一页
摘要: 1103 N的倍数 一个长度为N的数组A,从A中选出若干个数,使得这些数的和是N的倍数。 例如:N = 8,数组A包括:2 5 6 3 18 7 11 19,可以选2 6,因为2 + 6 = 8,是8的倍数。 Input 第1行:1个数N,N为数组的长度,同时也是要求的倍数。(2 <= N <= 5 阅读全文
posted @ 2017-08-20 15:02 Draymonder 阅读(366) 评论(0) 推荐(0) 编辑
摘要: A. Generous Kefa One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Ke 阅读全文
posted @ 2017-08-19 11:48 Draymonder 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1043 幸运号码 1个长度为2N的数,如果左边N个数的和 = 右边N个数的和,那么就是一个幸运号码。 例如:99、1230、123312是幸运号码。 给出一个N,求长度为2N的幸运号码的数量。由于数量很大,输出数量 Mod 10^9 + 7的结果即可。 Input 输入N(1<= N <= 100 阅读全文
posted @ 2017-08-18 16:03 Draymonder 阅读(377) 评论(0) 推荐(1) 编辑
摘要: 蚂蚁这道题 就是 不管两只蚂蚁相撞 他们会朝自己的反方向走 不过可以这么想 有蚂蚁1 和 蚂蚁2 并且相向而行 如果撞了以后 蚂蚁1和蚂蚁2 就往回走 ,这里可以理解成蚂蚁1,蚂蚁2 继续朝自己的方向走 因为我们是不关心 具体蚂蚁的到达哪个端点的 #include <bits/stdc++.h> u 阅读全文
posted @ 2017-08-17 16:57 Draymonder 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 暴力水过 #include<bits/stdc++.h> using namespace std; const int maxn = 1e3+10; int s[maxn]; bool b_s(int l,int r,int t) { int ans = -1; while (l <= r) { i 阅读全文
posted @ 2017-08-17 15:54 Draymonder 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 暴力 打表过的 注意爆int 还有 7的倍数 和 数字中有7的 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6+10; ll dp[maxn]; ll s[maxn]; v 阅读全文
posted @ 2017-08-17 15:36 Draymonder 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 没心情写数学题啦啊 好难啊 #include<bits/stdc++.h> using namespace std; set<int> s; set<int>::iterator it; int main () { s.clear(); for(int i=0;i*i<=1e9;i++) s.ins 阅读全文
posted @ 2017-08-17 15:19 Draymonder 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 通式: 其中p1, p2……pn为x的所有质因数,x是不为0的整数。 φ(1)=1(唯一和1互质的数(小于等于1)就是1本身)。 注意:每种质因数只一个。 比如12=2*2*3那么φ(12)=12*(1-1/2)*(1-1/3)=4 若n是质数p的k次幂, ,因为除了p的倍数外,其他数都跟n互质。 阅读全文
posted @ 2017-08-17 13:16 Draymonder 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 给出2个数M和N(M < N),且M与N互质,找出一个数K满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的。 Input 输入2个数M, N中间用空格分隔(1 <= M < N <= 10^9) Output 输出一个数K,满足0 < K < N且K * M %  阅读全文
posted @ 2017-08-17 12:33 Draymonder 阅读(178) 评论(0) 推荐(0) 编辑
摘要: a:特殊密码锁 总时间限制:1000ms内存限制:1024kB描述 有一种特殊的二进制密码锁,由n个相连的按钮组成(n<30),按钮有凹/凸两种状态,用手按按钮会改变其状态。 然而让人头疼的是,当你按一个按钮时,跟它相邻的两个按钮状态也会反转。当然,如果你按的是最左或者最右边的按钮,该按钮只会影响到 阅读全文
posted @ 2017-08-17 10:01 Draymonder 阅读(699) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 36 下一页