Submission #00004
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <cstring> #include <numeric> #include <algorithm> #include <functional> #include <array> #include <map> #include <queue> #include <limits.h> #include <set> #include <stack> #include <random> #include <complex> #include <unordered_map> #define rep(i,s,n) for(int i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define PW(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) #define MP(a,b) make_pair((a),(b)) #define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second)) #define pritnf printf #define scnaf scanf #define itn int #define PI 3.141592653589 #define izryt bool using namespace std; typedef long long ll; typedef pair< int , int > pii; typedef pair<ll, ll> pll; template < typename A, size_t N, typename T> void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } pii Dir[8] = { //移動 { 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 }, { 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 } }; signed main() { int n; scnaf( "%d" , &n); int ans = 0; rep(i, -n, n+1) { rep(j, -n, n + 1) { if (i*i + j*j == n * n) { ans++; } } } printf ( "%d\n" , ans); return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - コンパス |
ユーザー名 | もやし |
投稿日時 | 2017-03-30 20:02:17 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 1634 Byte |
最大実行時間 | 22 ms |
最大メモリ使用量 | 592 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01.in | AC | 16 ms | 480 KB |
1
|
02.in | AC | 22 ms | 468 KB |
1
|
03.in | AC | 17 ms | 452 KB |
1
|
04.in | AC | 18 ms | 560 KB |
1
|
05.in | AC | 13 ms | 544 KB |
1
|
06.in | AC | 12 ms | 400 KB |
1
|
07.in | AC | 16 ms | 516 KB |
1
|
08.in | AC | 20 ms | 372 KB |
1
|
09.in | AC | 17 ms | 480 KB |
1
|
10.in | AC | 20 ms | 592 KB |
1
|