結果
問題 |
No.1156 Nada Picnic 2
|
ユーザー |
👑 |
提出日時 | 2024-01-20 23:08:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 754 ms |
コンパイル使用メモリ | 76,200 KB |
最終ジャッジ日時 | 2025-02-18 21:55:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n;cin>>n; if(n==1){ cout << 1521 << endl; }else if(n==2){ cout << 10649 << endl; }else{ vector<int> x = {0,1,2,3,4,5,6,7,8,9}; vector<int> k = {100000, 10000-100000, 1000, 1100-10010, 10, 101, 10000, 10-100, 1, -1001}; do{ if(x[0] == 0 || x[1] == 0 || x[6] == 0)continue; int cur = 0; for(int i = 0; 10 > i; i++){ cur += x[i]*k[i]; } if(cur == 0){ cout << x[1] << x[3] << x[9] << x[7] << x[3] << x[9] << endl; return 0; } }while(next_permutation(x.begin(), x.end())); } }