結果
| 問題 |
No.362 門松ナンバー
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2016-03-16 02:09:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 62,532 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-10-01 20:11:10 |
| 合計ジャッジ時間 | 5,747 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 -- * 1 |
| other | AC * 4 TLE * 1 -- * 14 |
ソースコード
#include <iostream>
#include <set>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
bool is_kadomatsu_digit(long long x){
bool ok = true;
stringstream ss;
ss << x;
string s;
ss >> s;
if(s.size()<=2) return false;
int a = s[0] - '0';
int b = s[1] - '0';
for(int i=2; i<s.size(); i++){
int c = s[i] - '0';
if( (!(a>b && b<c && a!=c)) && (!(a<b && b>c && a!=c)) ) return false;
a = b;
b = c;
}
return true;
}
int main_(){
int n; cin >> n;
for(int i=100; n; i++){
if(is_kadomatsu_digit(i)){
n--;//s.insert(i);
}
if(n==0) cout << i << endl;
}
return 0;
}
#include <ctime>
int main(){
//auto s = clock();
int t;
cin >> t;
while(t--){
main_();
}
//cerr << clock()-s << endl;
return 0;
}
koyumeishi