結果
| 問題 |
No.51 やる気の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-27 01:00:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 337 bytes |
| コンパイル時間 | 2,008 ms |
| コンパイル使用メモリ | 192,036 KB |
| 最終ジャッジ日時 | 2025-02-24 12:58:32 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
In file included from /usr/include/c++/13/istream:41,
from /usr/include/c++/13/sstream:40,
from /usr/include/c++/13/complex:45,
from /usr/include/c++/13/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
inlined from ‘int main()’ at main.cpp:20:13:
/usr/include/c++/13/ostream:204:25: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:12:8: note: ‘ans’ was declared here
12 | ll ans;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; i++)
int main() {
cin.tie(nullptr);
ll W, D;
cin >> W >> D;
ll ans;
while (D > 0) {
ans = W / (D * D);
W -= ans;
D--;
}
cout << ans << '\n';
}