結果
問題 | No.491 10^9+1と回文 |
ユーザー |
|
提出日時 | 2025-05-18 21:24:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 2,109 ms |
コンパイル使用メモリ | 195,248 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-18 21:24:34 |
合計ジャッジ時間 | 5,353 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 61 |
ソースコード
#include<bits/stdc++.h> using namespace std; bool cmp(string a,string b){ return a.size()<b.size() || (a.size()==b.size() && a<=b); } signed main(){ // freopen("palindrome.in","r",stdin); // freopen("palindrome.out","w",stdout); string n; cin>>n; int cnt=0; // cout<<cmp("123","9")<<endl; for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ int t=9-i; string x; for(int k=1;k<=i;k++){ x+=to_string(j); } for(int k=1;k<=t;k++){ x+="0"; } for(int k=1;k<=i;k++){ x+=to_string(j); } // cout<<x<<endl; if(cmp(x,n)){ cnt++; }else{ cout<<cnt<<endl; return 0; } } } cout<<cnt<<endl; return 0; }