- 博客(4)
- 收藏
- 关注
原创 Codeforces 124B. Permutations
这题全排列可以下标,因为每一行的数字都得按同一规则全排列,而他们的下标都一样,再乘以相应的权值就行了!#include #include #include #include using namespace std; char s[20][20]; int a[20]; char index[20]; int t[20]; int main() { int n, k; int r
2015-03-24 00:09:21
239
原创 Codeforces 123A. Prime Permutation
看了题解找的规律之后,其实很简单,但是还是做了好久...规律就是:2到len/2和len/2之后的合数位置上的字母都必须一样,其余的补全就好了,下标从1开始会比较方便!#include #include #include #include using namespace std; bool is_prime(int x) { if(x == 1) return false; f
2015-03-24 00:02:50
233
原创 Codeforces Problem-124A. The number of positions
好简单,注意输入的a,b之和有可能大于n!#include #include using namespace std; int main() { int n; while(cin >> n) { int a, b; cin >> a >> b; if(a+b >= n) cout << n-a << endl; else cout << b+1 <
2015-03-22 23:37:21
285
原创 Codeforces Problems-122A. Lucky Division
直接从2到n枚举,能整除的就判断有无4和7就好了! #include #include using namespace std; bool f(int n) { while(n) { if(n % 10 != 4 && n % 10 != 7) return false; n /= 10; } retu
2015-03-22 23:33:02
170
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人