結果
問題 | No.141 魔法少女コバ |
ユーザー | hamray |
提出日時 | 2019-09-04 01:44:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,620 bytes |
コンパイル時間 | 1,567 ms |
コンパイル使用メモリ | 167,968 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-07 14:18:24 |
合計ジャッジ時間 | 4,232 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase-evil-0.txt | WA | - |
testcase-evil-1.txt | WA | - |
testcase-evil-2.txt | WA | - |
testcase-evil-3.txt | WA | - |
testcase-evil-4.txt | WA | - |
testcase-evil-5.txt | WA | - |
testcase-evil-6.txt | WA | - |
testcase-evil-7.txt | WA | - |
testcase-evil-8.txt | WA | - |
testcase-evil-9.txt | WA | - |
ソースコード
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; //conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } inline int readInt() { int x; scanf("%d", &x); return x; } //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<int, PII> TIII; typedef long long LL; typedef unsigned long long ULL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define SQ(a) ((a)*(a)) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,s,n) for(int i=s;i<(int)n;++i) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 #define rep(i, a, b) for(int i = a; i < (b); ++i) #define trav(a, x) for(auto& a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; const double EPS = 1E-8; #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) const int INF = 100000000; struct Edge { int to, from; ll cost; Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {} }; struct UnionFind { vector<int> data; UnionFind(int size) : data(size, -1) { } bool unionSet(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool findSet(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } }; typedef vector<vector<Edge>> AdjList; AdjList graph; bool comp(const Edge& e1, const Edge& e2) { return e1.cost < e2.cost; } vector<int> split_naive(const string &s, char delim) { vector<int> elems; string item; for (char ch: s) { if (ch == delim) { if (!item.empty()) elems.push_back(atoi(item.c_str())); item.clear(); } else { item += ch; } } if (!item.empty()) elems.push_back(atoi(item.c_str())); return elems; } ll mod_pow(ll x, ll n, ll mod){ ll res = 1; bool c = false; while(n){ if(n&1) res = res * x; if(res > mod){ c = true; res %= mod; } x = x * x %mod; n >>= 1; } if(c) return mod; return res; } #define SIEVE_SIZE 9000*9000 bool sieve[SIEVE_SIZE]; void make_sieve(){ for(int i=0; i<SIEVE_SIZE; ++i) sieve[i] = true; sieve[0] = sieve[1] = false; for(int i=2; i*i<SIEVE_SIZE; ++i) if(sieve[i]) for(int j=2; i*j<SIEVE_SIZE; ++j) sieve[i*j] = false; } bool isprime(ll n){ for(ll i=2; i*i<=n; ++i) if(n%i==0) return false; return true; } template<typename T> vector<T> gauss_jordan(const vector<vector<T>>& A, const vector<T>& b){ int n = A.size(); vector<vector<T>> B(n, vector<T>(n+1)); for(int i=0; i<n; ++i){ for(int j=0; j<n; ++j){ B[i][j] = A[i][j]; } } for(int i=0; i<n; ++i) B[i][n] = b[i]; for(int i=0; i<n; ++i){ int pivot = i; for(int j=i; j<n; ++j){ if(abs(B[j][i]) > abs(B[pivot][i])) pivot = j; } swap(B[i], B[pivot]); if(abs(B[i][i]) < EPS) return vector<T>(); //解なし for(int j=i+1; j<=n; ++j) B[i][j] /= B[i][i]; for(int j=0; j<n; ++j){ if(i != j){ for(int k=i+1; k<=n; ++k) B[j][k] -= B[i][j] * B[i][k]; } } } vector<T> x(n); for(int i=0; i<n; ++i) x[i] = B[i][n]; return x; } typedef complex<double> P; namespace std { bool operator < (const P& a, const P& b) { return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b); } } double cross(const P& a, const P& b) { return imag(conj(a)*b); } double dot(const P& a, const P& b) { return real(conj(a)*b); } struct L : public vector<P> { L(const P &a, const P &b) { push_back(a); push_back(b); } }; typedef vector<P> G; struct C { P p; double r; C(const P &p, double r) : p(p), r(r) { } }; int ccw(P a, P b, P c) { b -= a; c -= a; if (cross(b, c) > 0) return +1; // counter clockwise if (cross(b, c) < 0) return -1; // clockwise if (dot(b, c) < 0) return +2; // c--a--b on line if (norm(b) < norm(c)) return -2; // a--b--c on line return 0; } ll GCD(ll a, ll b){ if(b == 0) return a; return GCD(b, a%b); } int main() { //cin.tie(0); //ios::sync_with_stdio(false); //cout << fixed << setprecision(10); ll M,N; cin >> M >> N; ll d = GCD(N, M); M /= d; N /= d; ll cnt=0; while(1){ if(M == 0) break; if(M < N){ cnt++; swap(M, N); } cnt += M/N; cout << M << " " << N << endl; M -= N* (M/N); cout << M << " " << N << endl; } cout << cnt-1 << endl; return 0; }