結果

問題 No.51 やる気の問題
ユーザー sasa
提出日時 2025-03-05 11:43:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 195 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 25,728 KB
実行使用メモリ 8,612 KB
最終ジャッジ日時 2025-03-05 11:43:59
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
    5 |         scanf("%d %d",work,day);
      |                ~^     ~~~~
      |                 |     |
      |                 int*  int
main.cpp:5:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘int’ [-Wformat=]
    5 |         scanf("%d %d",work,day);
      |                   ~^       ~~~
      |                    |       |
      |                    int*    int
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d %d",work,day);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:5:14: warning: ‘work’ is used uninitialized [-Wuninitialized]
    5 |         scanf("%d %d",work,day);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:4:13: note: ‘work’ was declared here
    4 |         int work, day;
      |             ^~~~
main.cpp:5:14: warning: ‘day’ is used uninitialized [-Wuninitialized]
    5 |         scanf("%d %d",work,day);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:4:19: note: ‘day’ was declared here
    4 |         int work, day;
      |                   ^~~

ソースコード

diff #

#include <stdio.h>

int main(){
	int work, day;
	scanf("%d %d",work,day);
	
	int motivation = 0;
	while(day > 0){
		motivation = work / (day * day);
		work -= motivation;
	}
	printf("%d",work);
}
0