結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー AQUA16573837
提出日時 2018-03-11 23:16:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 310 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 33,860 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-28 19:00:30
合計ジャッジ時間 1,070 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |                 scanf("%d", &a);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <algorithm>

int main() {
	int a, total = 0;
	for (int i = 0; i < 5; i++) {
		scanf("%d", &a);
		if (a % 3 == 0 || a % 5 == 0) {
			if (a % 3 == 0)
				total += 4;
			if (a % 5 == 0)
				total += 4;
		} else {
			while (a != 0)
				total++, a /= 10;
		}
	}
	printf("%d\n", total);
}
0