USER: Jeremy Wu [wushuai2] TASK: ariprog LANG: C++ Compiling... Compile: OK Executing... Test 1: TEST OK [0.005 secs, 11880 KB] Test 2: TEST OK [0.008 secs, 11880 KB] Test 3: TEST OK [0.008 secs, 11876 KB] Test 4: TEST OK [0.014 secs, 11880 KB] Test 5: TEST OK [0.016 secs, 11880 KB] Test 6: TEST OK [0.065 secs, 11880 KB] Test 7: TEST OK [0.378 secs, 11880 KB] Test 8: TEST OK [0.818 secs, 11880 KB] Test 9: TEST OK [0.802 secs, 11876 KB] All tests OK.
Your program ('ariprog') produced all correct answers! This is your submission #5 for this problem. Congratulations!
还是算蛮简单的一道构造题目= = 差点以为是要去搜索了...
/* ID: wushuai2 PROG: ariprog LANG: C++ */ //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler #include <stdio.h> #include <iostream> #include <fstream> #include <cstring> #include <cmath> #include <stack> #include <string> #include <map> #include <set> #include <list> #include <queue> #include <vector> #include <algorithm> #define Max(a,b) (((a) > (b)) ? (a) : (b)) #define Min(a,b) (((a) < (b)) ? (a) : (b)) #define Abs(x) (((x) > 0) ? (x) : (-(x))) #define MOD 1000000007 #define pi acos(-1.0) using namespace std; typedef long long ll ; typedef unsigned long long ull ; typedef unsigned int uint ; typedef unsigned char uchar ; template<class T> inline void checkmin(T &a,T b){if(a>b) a=b;} template<class T> inline void checkmax(T &a,T b){if(a<b) a=b;} const double eps = 1e-7 ; const int M = 660000 ; const ll P = 10000000097ll ; const int INF = 0x3f3f3f3f ; const int MAX_N = 20 ; int n, m; bool status[M]; int a[M], len; int llen; struct sc{ int a, b; }ans[M]; bool cmp(struct sc a, struct sc b){ if(a.b == b.b) return a.a < b.a; return a.b < b.b; } void init(){ int i, j; memset(a, 0, sizeof(a)); len = 0; memset(status, 0, sizeof(status)); for(i = 0; i <= m; ++i){ for(j = 0; j <= m; ++j){ int num = i * i + j * j; if(status[num]) continue; status[num] = true; a[len++] = num; } } a[len] = '