結果

問題 No.51 やる気の問題
コンテスト
ユーザー tntan
提出日時 2015-12-15 05:15:34
言語 C++11(old_compat)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -include bits/stdc++.h -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 331 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,214 ms
コンパイル使用メモリ 167,188 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:04:56
合計ジャッジ時間 1,847 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /usr/include/c++/12/istream:39,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from <command-line>:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>]’,
    inlined from ‘int main()’ at main.cpp:22:10:
/usr/include/c++/12/ostream:221:25: warning: ‘k’ may be used uninitialized [-Wmaybe-uninitialized]
  221 |       { return _M_insert(__f); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:13:22: note: ‘k’ was declared here
   13 |         double w, d, k;
      |                      ^

ソースコード

diff #
raw source code

#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
#include<vector>
#include<cctype>
#include<algorithm>
using namespace std;
static const int MAX_N = 1000005;

int main()
{
	double w, d, k;
	cin >> w >> d;
	while (w > 0)
	{
		k = w / (d*d);
		k = floor(k);
		w -= k;
		d--;
	}
	cout << k << endl;
	return 0;
}
0