結果
| 問題 |
No.3240 Count 8 Included Numbers (Easy)
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-08-24 19:05:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 384 ms |
| コンパイル使用メモリ | 41,564 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-24 19:05:22 |
| 合計ジャッジ時間 | 1,417 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3240.cc: No.3240 Count 8 Included Numbers (Easy) - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* main */
int main() {
int n;
scanf("%d", &n);
int cnt = 0;
for (int i = 1; i <= n; i++) {
bool ok = false;
for (int j = i; j > 0; j /= 10)
if (j % 10 == 8) { ok = true; break; }
if (ok) cnt++;
}
printf("%d\n", cnt);
return 0;
}
tnakao0123