题目链接:http://www.codeforces.com/problemset/problem/472/A题意:给你一个数n,将n表示为两个合数(即非素数)的和.C++代码: #include <iostream> using namespace std; bool isprime(int x) { ; i * i <= x; i ++) ) return false; return true; } int main() { int n; cin >> n; ;i <…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and…
题意:给出一个距离矩阵,问是不是一颗正确的带权树. 解法:先按找距离矩阵建一颗最小生成树,因为给出的距离都是最短的点间距离,然后再对每个点跑dfs得出应该的dis[][],再对比dis和原来的mp是否一致即可. 首先还要判断一些东西.具体看代码吧. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #in…
Codeforces Round #270 A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random math s…
Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from life. You can choose some experience in real life, formalize it an…
Codeforces Round #270 1002 B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from life. You can choose some experience…
Codeforces Round #270 1001 A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random m…
Codeforces Round #270 1003 C. Design Tutorial: Make It Nondeterministic time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A way to make a new task is to make it nondeterministic or probabili…
Codeforces Round #270 B:http://codeforces.com/contest/472/problem/B 题意:n个人在1楼,想要做电梯上楼,只有1个电梯,每次只能运k个人,每移动一层需要1秒.问最小的是时间把所有人送到想去的楼层. 题解:贪心,每次选择楼层数最大k个人,用优先队列维护一下即可. #include<iostream> #include<cstdio> #include<cstring> #include<algorit…
B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from life. You can choose some experience in real life, formalize it…