Submission #48552594
Source Code Expand
Copy
#include<bits/stdc++.h>#define mz 998244353using namespace std;long long ok(int x){long long y=0;//cout<<x<<":";while(x--){y=y*10+1;}//cout<<y<<endl;return y;}int main(){int n,x;long long ans=0;scanf("%d",&n);for(int i=1;i<=18;i++){if(n<=i*(i+1)/2){
#include<bits/stdc++.h> #define mz 998244353 using namespace std; long long ok(int x){ long long y=0; //cout<<x<<":"; while(x--){ y=y*10+1; } //cout<<y<<endl; return y; } int main(){ int n,x; long long ans=0; scanf("%d",&n); for(int i=1;i<=18;i++){ if(n<=i*(i+1)/2){ for(int j=1;j<=i;j++){ if(n<=j){ printf("%lld\n",ok(i)+ok(j)+ok(n)); break; } else n-=j; } break; } else n-=i*(i+1)/2; } return 0; } /* */
Submission Info
Submission Time | |
---|---|
Task | C - Repunit Trio |
User | TryMyEdge |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 505 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3916 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:17:15: warning: unused variable ‘x’ [-Wunused-variable] 17 | int n,x; | ^ Main.cpp:18:19: warning: unused variable ‘ans’ [-Wunused-variable] 18 | long long ans=0; | ^~~ Main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d",&n); | ~~~~~^~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 3900 KB |
00_sample_02.txt | AC | 1 ms | 3848 KB |
00_sample_03.txt | AC | 1 ms | 3576 KB |
01_test_01.txt | AC | 1 ms | 3660 KB |
01_test_02.txt | AC | 1 ms | 3688 KB |
01_test_03.txt | AC | 1 ms | 3704 KB |
01_test_04.txt | AC | 1 ms | 3848 KB |
01_test_05.txt | AC | 1 ms | 3700 KB |
01_test_06.txt | AC | 1 ms | 3664 KB |
01_test_07.txt | AC | 1 ms | 3716 KB |
01_test_08.txt | AC | 1 ms | 3664 KB |
01_test_09.txt | AC | 1 ms | 3788 KB |
01_test_10.txt | AC | 1 ms | 3808 KB |
01_test_11.txt | AC | 1 ms | 3720 KB |
01_test_12.txt | AC | 1 ms | 3684 KB |
01_test_13.txt | AC | 1 ms | 3916 KB |
01_test_14.txt | AC | 1 ms | 3792 KB |
01_test_15.txt | AC | 1 ms | 3824 KB |
01_test_16.txt | AC | 1 ms | 3580 KB |
01_test_17.txt | AC | 1 ms | 3576 KB |