제출 #1126702

#제출 시각아이디문제언어결과실행 시간메모리
1126702KasymK수열 (BOI14_sequence)C++20
34 / 100
74 ms584 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 1e5+5; int v[N]; vector<int> take(int x){ vector<int> ret; while(x) ret.pb(x%10), x/=10; return ret; } int main(){ int k; scanf("%d", &k); for(int i = 1; i <= k; ++i) scanf("%d", v+i); if(k<=1000){ for(int ad = 0; ad <= 1000; ++ad){ bool plz = 1; for(int i = 1; i <= k; ++i){ vector<int> A = take(ad+i-1); bool did = 0; for(int j = 0; j < (int)A.size() and !did; ++j) if(A[j]==v[i]) did=1; plz &= did; } if(plz){ printf("%d\n", ad); exit(0); } } } int ad = v[1]; if(ad>=1 and ad<=8){ printf("%d", ad); int mal = ceil(log10(k)); while(mal--) printf("0"); puts(""); return 0; } int x = 0, sm = 0; while(1){ sm += pow(10, x); if(sm >= k) break; x++; } if(ad==9){ while(x--) printf("8"); printf("9\n"); return 0; } assert(ad==0); printf("1"); x++; while(x--) printf("0"); puts(""); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

sequence.cpp: In function 'int main()':
sequence.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf("%d", &k);
      |         ~~~~~^~~~~~~~~~
sequence.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%d", v+i);
      |         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...