結果

問題 No.491 10^9+1と回文
コンテスト
ユーザー vjudge1
提出日時 2025-05-16 16:00:44
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 333 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,173 ms
コンパイル使用メモリ 199,232 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-10 17:36:34
合計ジャッジ時間 6,105 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 103
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         freopen("palindrome.in","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:18:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         freopen("palindrome.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n;
int check(int x){
	int num=-1;
	int t=0;
	while (x){
		t=x%10;
		x/=10;
		num++;
	}
	return num*9+t;
}
signed main ()
{
	freopen("palindrome.in","r",stdin); 
	freopen("palindrome.out","w",stdout); 
	cin>>n;
	int x=n/1000000001;
	cout<<check(x);
	return 0;
}
0