結果

問題 No.2259 Gas Station
ユーザー Kinoto
提出日時 2023-04-16 23:11:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 04:36:51
合計ジャッジ時間 1,480 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:9:19: warning: 'L' is used uninitialized [-Wuninitialized]
    9 |         int l = L - L / 10000 * 10000;
      |                 ~~^~~~~~~~~~~~~~~~~~~
main.cpp:6:13: note: 'L' declared here
    6 |         int L,R,C,A;
      |             ^
main.cpp:10:19: warning: 'C' is used uninitialized [-Wuninitialized]
   10 |         int c = C - C / 10000 * 10000;
      |                 ~~^~~~~~~~~~~~~~~~~~~
main.cpp:6:17: note: 'C' declared here
    6 |         int L,R,C,A;
      |                 ^

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
	int L,R,C,A;
	long N;
	A = 999;
	int l = L - L / 10000 * 10000;
	int c = C - C / 10000 * 10000;
	cin >> L >> R >> C;
	for (int x = l; x < l+999; x++){
		N = x * c;
		if (A > ((N - 1) / 1000 + 1) * 1000 - N) {
			A = ((N - 1) / 1000 + 1) * 1000 - N;
		}
		cout << x << " " << (x * c - 1) << " " << ((x * c - 1) / 1000 + 1) << " " << ((N - 1) / 1000 + 1) * 1000 - N << endl;
	}
	cout << A << endl;
	return 0;
}
0