Submission #107588

# Submission time Handle Problem Language Result Execution time Memory
107588 2019-04-25T08:39:08 Z patrikpavic2 Sequence (BOI14_sequence) C++17
25 / 100
2 ms 384 KB
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <map>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef vector < int > vi;
typedef set < int > si;

const int N = 1e5 + 500;
const int M = 1e6 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int OFF = (1 << 18);
const int LOG = 20;
const double EPS = 1e-9;
const double PI = 3.1415926535;

int n, x;

int main(){
    scanf("%d%d", &n, &x);
    if(x == 0){
        int pot = 1;
        while(pot - (pot / 10 * 9) - 1 < n){
            pot = 10 * pot + 1;
        }
        printf("%d\n", (pot / 10 * 9) + 1);
        return 0;
    }
    if(x == 9){
        int pot = 1, pot2 = 1;
        while(pot2 - (pot / 10 * 8) - 1 < n){
            pot = 10 * pot + 1;
            pot2 = 10 * pot2;
        }
        printf("%d\n", (pot / 10 * 8) + 1);
        return 0;
    }
    printf("%d", x);
    for(int i = 1;i < n;i *= 10) printf("0");
    printf("\n");
    return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &x);
     ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -