![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Codeforces
dominjune
这个作者很懒,什么都没留下…
展开
-
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论