Submission #1794001


Source Code Expand

#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

long long gcd(long long a, long long b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int N;
    cin >> N;

    int total = 0;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            total += i * j;
        }
    }

    int diff = total - N;
    int candidate;
    for (int i = 1; i < 10; ++i) {
        candidate = diff / i;
        if (diff % i == 0 && 0 <= candidate && candidate < 10) {
            cout << i << " x " << candidate << endl;
        }
    }
    return 0;
}

Submission Info

Submission Time
Task C - 九九足し算
User xeonics
Language C++11 (GCC 4.8.1)
Score 100
Code Size 3034 Byte
Status AC
Exec Time 6 ms
Memory 768 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 20
Set Name Test Cases
All sample_01.txt, sample_02.txt, test_1953.txt, test_1971.txt, test_1977.txt, test_1983.txt, test_1989.txt, test_1990.txt, test_1993.txt, test_1995.txt, test_1997.txt, test_1998.txt, test_2001.txt, test_2009.txt, test_2013.txt, test_2017.txt, test_2019.txt, test_2020.txt, test_2022.txt, test_2024.txt
Case Name Status Exec Time Memory
sample_01.txt AC 6 ms 768 KB
sample_02.txt AC 1 ms 256 KB
test_1953.txt AC 1 ms 256 KB
test_1971.txt AC 1 ms 256 KB
test_1977.txt AC 1 ms 256 KB
test_1983.txt AC 1 ms 256 KB
test_1989.txt AC 1 ms 256 KB
test_1990.txt AC 1 ms 256 KB
test_1993.txt AC 1 ms 256 KB
test_1995.txt AC 1 ms 256 KB
test_1997.txt AC 1 ms 256 KB
test_1998.txt AC 1 ms 256 KB
test_2001.txt AC 1 ms 256 KB
test_2009.txt AC 1 ms 256 KB
test_2013.txt AC 1 ms 256 KB
test_2017.txt AC 1 ms 256 KB
test_2019.txt AC 1 ms 256 KB
test_2020.txt AC 1 ms 256 KB
test_2022.txt AC 1 ms 256 KB
test_2024.txt AC 1 ms 256 KB