結果

問題 No.51 やる気の問題
ユーザー KoryKory
提出日時 2016-10-12 07:42:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,518 ms / 5,000 ms
コード長 1,481 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 161,792 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 20:03:28
合計ジャッジ時間 35,318 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 143 ms
6,940 KB
testcase_04 AC 43 ms
6,940 KB
testcase_05 AC 2,420 ms
6,940 KB
testcase_06 AC 1,656 ms
6,940 KB
testcase_07 AC 1,598 ms
6,940 KB
testcase_08 AC 911 ms
6,944 KB
testcase_09 AC 3,518 ms
6,940 KB
testcase_10 AC 1,083 ms
6,940 KB
testcase_11 AC 929 ms
6,944 KB
testcase_12 AC 1,796 ms
6,944 KB
testcase_13 AC 1,874 ms
6,944 KB
testcase_14 AC 1,434 ms
6,940 KB
testcase_15 AC 2,783 ms
6,940 KB
testcase_16 AC 743 ms
6,940 KB
testcase_17 AC 241 ms
6,940 KB
testcase_18 AC 2,890 ms
6,940 KB
testcase_19 AC 2,989 ms
6,940 KB
testcase_20 AC 1,715 ms
6,944 KB
testcase_21 AC 235 ms
6,940 KB
testcase_22 AC 3,493 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

// macros
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define INT_IN(a) int a; cin >> a
#define STR_IN(s) string s; cin >> s
#define PRINTLN(s) cout << s << endl
#define PRINTDOUBLELN(s) cout << setprecision(12) << (s) << endl;

// util functions
template<class T> inline T sqr(T x) {return x*x;}

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();}

template <typename T>inline T max(vector<T> v){T max=v[0]; FOR(i, 1, v.size())max=MAX(v[i], max); return max;}
template <typename T>inline T min(vector<T> v){T min=v[0]; FOR(i, 1, v.size())min=MIN(v[i], min); return min;}
template <typename T>inline vector<T> concat(vector<T> a, vector<T> b){vector<T> ab; ab.reserve(a.size()+b.size());ab.insert(ab.end(),a.begin(),a.end());ab.insert(ab.end(),b.begin(),b.end());return ab;}

// types
typedef long long LL;

// consts
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//debug
#define dump(x)  #x << " = " << (x) << endl
#define debug(x) #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

int main(){
    INT_IN(W);
    INT_IN(D);
    for(; D > 1 ; D--){
        int wd = floor(1.*W / (1.*D*D));
        W -= wd;
        cerr << debug(D) << debug(wd) << debug(W);
    }
    PRINTLN(W);
    return 0;
}

0