結果

問題 No.1033 乱数サイ
ユーザー Baxi-codesBaxi-codes
提出日時 2020-04-24 23:14:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 1,526 ms
コンパイル使用メモリ 162,088 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-23 04:13:58
合計ジャッジ時間 7,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:14:29: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
   14 |                         sum += (1/((n+1)*k))*i;
      |                         ~~~~^~~~~~~~~~~~~~~~~~
main.cpp:8:15: note: 'sum' was declared here
    8 |         float sum;
      |               ^~~

ソースコード

diff #

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

void solve(){
	float n,k;
	float sum;
	cin>>n>>k;
	for (int i = 0; i <= n; ++i)
	{
		for (int j = 0; j < k; ++j)
		{
			sum += (1/((n+1)*k))*i;
		}
	}
	cout<<sum;
}

int main() {
	solve();
}
0