Codeforces #270 A. Design Tutorial: Learn from Math(数论:素数判断)
2014-09-29 03:10
786 查看
很水的一道题,直接贴代码:
#include <bits/stdc++.h> using namespace std; bool judge(int x) { for(int i=2; i*i<=x; ++i) { if(x % i == 0) return true; } return false; } int main(void) { int n; scanf("%d", &n); for(int i=4; i<n; ++i) { if(judge(i) && judge(n-i)) { printf("%d %d\n", i, n-i); break; } } return 0; }
相关文章推荐
- codeforces水题100道 第七题 Codeforces Round #270 A. Design Tutorial: Learn from Math (math)
- Codeforces Design Tutorial: Learn from Math
- Codeforces Round #270--B. Design Tutorial: Learn from Life
- Codeforces Round #270--B. Design Tutorial: Learn from Life
- Codeforces #270 B. Design Tutorial: Learn from Life(数据结构:优先队列模拟题)
- codeforce A. Design Tutorial: Learn from Math
- codeforces B. Design Tutorial: Learn from Life
- Codeforces #270 C. Design Tutorial: Make It Nondeterministic(字符串:字符串处理)
- A. Design Tutorial: Learn from Math
- Codeforces Round #270 F Design Tutorial: Change the Goal 高斯消元
- Codeforces Round #270 G. Design Tutorial: Increase the Constraints 分块+FFT
- Codeforces Round #270 D Design Tutorial: Inverse the Problem --MST + DFS
- A. Design Tutorial: Learn from Math
- codeforces D. Design Tutorial: Inverse the Problem
- B. Design Tutorial: Learn from Life
- codeforces C. Design Tutorial: Make It Nondeterministic
- 【CODEFORCES】 B. Design Tutorial: Learn from Life
- Codeforces Round #324 (Div. 2) (快速判断素数模板)
- Codeforces Round #270 A.(素数打表)
- [构造 八数码] Codeforces 472E #270 E. Design Tutorial: Learn from a Game