Submission #00054
ソースコード
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | #include <iostream> #include <cstdio> #include <string> #include <vector> #include <algorithm> #include <functional> #include <iomanip> #include <stdlib.h> #include <string.h> #include <cstring> #include <cmath> #include <map> #include <queue> #include <deque> #include <stack> #include <set> #include <stdio.h> #include <tuple> #include <bitset> #include <cfloat> #include <fstream> #include <limits.h> #include <list> #include <math.h> #include <random> #include <unordered_map> #include <unordered_set> #include <bitset> #include <numeric> #include <utility> #include <sstream> #include <cassert> template < class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true ; } return false ; } template < class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true ; } return false ; } using namespace std; #define int long long #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define P pair<ll, ll> #define sz(x) (ll)x.size() #define ALL(x) (x).begin(),(x).end() #define ALLR(x) (x).rbegin(),(x).rend() #define VE vector<ll> #define COUT(x) cout<<(x)<<endl #define MA map<ll,ll> #define SE set<ll> #define PQ priority_queue<ll> #define PQR priority_queue<ll,VE,greater<ll>> #define COUT(x) cout<<(x)<<endl #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define EPS (1e-10) #define pb push_back const long long MOD = 1000000007; //const long long MOD = 998244353; const long long INF = 1LL << 60; const double PI = acos (-1.0); using Graph = vector<VE>; struct mint { ll x; // typedef long long ll; mint(ll x = 0) :x((x%MOD + MOD) % MOD) {} mint operator-() const { return mint(-x); } mint& operator+=( const mint a) { if ((x += a.x) >= MOD) x -= MOD; return * this ; } mint& operator-=( const mint a) { if ((x += MOD - a.x) >= MOD) x -= MOD; return * this ; } mint& operator*=( const mint a) { (x *= a.x) %= MOD; return * this ; } mint operator+( const mint a) const { mint res(* this ); return res += a; } mint operator-( const mint a) const { mint res(* this ); return res -= a; } mint operator*( const mint a) const { mint res(* this ); return res *= a; } mint pow (ll t) const { if (!t) return 1; mint a = pow (t >> 1); a *= a; if (t & 1) a *= * this ; return a; } // for prime MOD mint inv() const { return pow (MOD - 2); } mint& operator/=( const mint a) { return (* this ) *= a.inv(); } mint operator/( const mint a) const { mint res(* this ); return res /= a; } }; struct combination { vector<mint> fact, ifact; combination( int n) :fact(n + 1), ifact(n + 1) { //assert(n < MOD); fact[0] = 1; for ( int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for ( int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()( int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }com(10); struct edge { ll to, cost; }; class UnionFind { public : vector <ll> par; // 各元の親を表す配列 vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化) // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1) { for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } void init(ll sz_) { par.resize(sz_); siz.resize(sz_, 1); for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false ; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true ; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } }; ll gcd(ll a, ll b) { if (a < b)swap(a, b); if (b == 0) return a; unsigned r; while ((r = a % b)) { a = b; b = r; } return b; } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; } bool prime(ll n) { for (ll i = 2; i <= sqrt (n); i++) { if (n%i == 0) return false ; } return n != 1; } map<ll, ll> prime_factor(ll n) { map<ll, ll> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } ll modinv(ll a, ll m) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } vector<pair< char , int >> RunLength(string s) { if (s.size() == 0) return {}; vector<pair< char , int >>res(1, pair< char , int >(s[0], 0)); for ( char p : s) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } // Digit Count int GetDigit( int num) { return log10 (num) + 1; } // bit calculation[how many "1"] (= __builtin_popcount()) int bit_count( int n) { int cnt = 0; while (n > 0) { if (n % 2 == 1)cnt++; n /= 2; } return cnt; } mint POW(mint n, int p) { if (p == 0) return 1; if (p % 2 == 0) { mint t = POW(n, p / 2); return t * t; } return n * POW(n, p - 1); } #define ld long double const int dx[4] = { 1,0,-1,0 }; const int dy[4] = { 0,1,0,-1 }; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //cout << fixed << setprecision(15); int n, m, d; cin >> n >> m >> d; int ans = n; int ans2 = 0; rep(i, d) { if (ans >= m) { ans2 += m; ans -= m; } else { ans2 += ans; ans = 0; } } cout << ans2 << endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - Eating NAMEKUZI |
ユーザー名 | Example |
投稿日時 | 2020-03-02 21:03:56 |
言語 | C++14 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 6000 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 748 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 100 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 28 ms | 604 KB |
1
|
in02.txt | AC | 19 ms | 560 KB |
1
|
in03.txt | AC | 20 ms | 640 KB |
1
|
in04.txt | AC | 20 ms | 596 KB |
1
|
in05.txt | AC | 31 ms | 424 KB |
1
|
in06.txt | AC | 19 ms | 640 KB |
1
|
in07.txt | AC | 24 ms | 468 KB |
1
|
in08.txt | AC | 28 ms | 552 KB |
1
|
in09.txt | AC | 23 ms | 504 KB |
1
|
in10.txt | AC | 23 ms | 592 KB |
1
|
in11.txt | AC | 25 ms | 544 KB |
1
|
in12.txt | AC | 18 ms | 496 KB |
1
|
in13.txt | AC | 21 ms | 452 KB |
1
|
in14.txt | AC | 16 ms | 540 KB |
1
|
in15.txt | AC | 23 ms | 496 KB |
1
|
in16.txt | AC | 21 ms | 580 KB |
1
|
sample01.txt | AC | 22 ms | 664 KB |
1
|
sample02.txt | AC | 19 ms | 748 KB |
1
|