結果

問題 No.3240 Count 8 Included Numbers (Easy)
ユーザー Sillpherth
提出日時 2025-08-25 09:00:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 78,156 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-25 09:00:08
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<iostream>

int main(void)
{
	int N = 0;
	int result = 0;
	std::cin >> N;
	if(N>799)
	{
		result = 152 + N - 799;
		std::cout << result;
		return 0;
	}else
	{
		int n = N/100;
		result += n*19;
		N -= n*100;
		if(N>79)
		{
			result += 8 + N - 79;
			if(N>89)
			{
				result -= N-89;
			}
			std::cout << result;
			return 0;
		}else
		{
			n = N/10;
			result += n;
			N -= n*10;
			if(N>7)
			{
				result += 1;
			}
			std::cout << result;
			return 0;
		}
	}
}
0