Submission #56206
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #include <set> #include <map> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <vector> #include <string> #include <bitset> #include <cctype> #include <cstdlib> #include <cstring> #include <utility> #include <numeric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> using namespace std; typedef long long ll; typedef vector< int > vint; typedef pair< int , int > pint; typedef vector< long long > vlong; #define vpush(a,x) a.push_back(x); #define rep(i, n) REP(i, 0, n) #define all(v) v.begin(), v.end() #define REP(i, x, n) for(int i = x; i < n; i++) #define INF 2e9 int fact( int n){ int m; if (n == 0) return 1; m = fact(n - 1); return n * m; } signed main(){ cin.tie(0); ios::sync_with_stdio( false ); long long n,k,count=0,b=1,c; cin>>n>>k; rep(i,n){ b*=10; } long long d=b; long long a=k; if (d==10){ count+=9/k; } else { rep(i,2){ if (b==d){ count+=((d/k)-1); } else { count-=((d/k)-1); } d/=10; } } /* while(true){ if(a>=c){ break; } a+=k; } while(true){ if(b<a){ break; } count++; a+=k; } */ cout<<count<< '\n' ; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1204 - Password |
ユーザー名 | ei1903 |
投稿日時 | 2019-11-07 16:28:41 |
言語 | C++14 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 1476 Byte |
最大実行時間 | 33 ms |
最大メモリ使用量 | 728 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | in* |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in00-1.txt | AC | 33 ms | 600 KB |
1
|
in00-2.txt | AC | 19 ms | 676 KB |
1
|
in00-3.txt | AC | 21 ms | 504 KB |
1
|
in01.txt | AC | 20 ms | 588 KB |
1
|
in02.txt | AC | 18 ms | 544 KB |
1
|
in03.txt | AC | 24 ms | 496 KB |
1
|
in04.txt | AC | 23 ms | 448 KB |
1
|
in05.txt | AC | 22 ms | 536 KB |
1
|
in06.txt | AC | 29 ms | 488 KB |
1
|
in07.txt | AC | 16 ms | 572 KB |
1
|
in08.txt | AC | 23 ms | 532 KB |
1
|
in09.txt | AC | 22 ms | 612 KB |
1
|
in10.txt | AC | 18 ms | 564 KB |
1
|
in11.txt | AC | 21 ms | 520 KB |
1
|
in12.txt | AC | 22 ms | 476 KB |
1
|
in13.txt | AC | 16 ms | 564 KB |
1
|
in14.txt | AC | 27 ms | 652 KB |
1
|
in15.txt | AC | 14 ms | 604 KB |
1
|
in16.txt | AC | 20 ms | 560 KB |
1
|
in17.txt | AC | 25 ms | 640 KB |
1
|
in18.txt | AC | 21 ms | 728 KB |
1
|
in19.txt | AC | 21 ms | 684 KB |
1
|
in20.txt | AC | 25 ms | 644 KB |
1
|
sample01.txt | AC | 22 ms | 592 KB | |
sample02.txt | AC | 18 ms | 552 KB |