結果
| 問題 |
No.51 やる気の問題
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2017-06-20 21:18:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 5,000 ms |
| コード長 | 265 bytes |
| コンパイル時間 | 541 ms |
| コンパイル使用メモリ | 66,392 KB |
| 最終ジャッジ日時 | 2025-01-05 00:45:30 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
In file included from /usr/include/c++/13/iostream:41,
from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
inlined from ‘int main()’ at main.cpp:17:11:
/usr/include/c++/13/ostream:169:25: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
169 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:11:8: note: ‘ans’ was declared here
11 | long ans;
| ^~~
ソースコード
#include <iostream>
using namespace std;
int main() {
long w;
long d;
cin >> w;
cin >> d;
long work;
long ans;
for(long i = 0; i < d; i++) {
work = w / ((d - i) * (d - i));
ans = work;
w -= work;
}
cout << ans << endl;
return 0;
}
takeya_okino