結果

問題 No.491 10^9+1と回文
ユーザー umaumax
提出日時 2017-05-08 21:15:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 57,832 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 17:33:30
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 80
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>

using namespace std;

int main(int argc, const char* argv[])
{
	uint64_t N;
	cin >> N;
	uint64_t b = (uint64_t)1e9 + 1;
	//	1~9 : 9
	//	11~99 : 18
	//	111~999 :
	//	...
	//	11111111~99999999
	int cnt = 0;
	N /= b;
	uint64_t minval = 10;
	while (N > 0) {
		minval = min(minval, N % 10);
		cnt += N >= 10 ? 9 : 0;
		N /= 10;
	}
	cnt += minval;
	cout << cnt << endl;
	return 0;
}
0