結果

問題 No.2016 Countdown Divisors
ユーザー milanis48663220milanis48663220
提出日時 2022-07-22 21:39:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 1,872 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 117,696 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 09:15:35
合計ジャッジ時間 4,830 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 145 ms
4,380 KB
testcase_02 AC 145 ms
4,384 KB
testcase_03 AC 129 ms
4,380 KB
testcase_04 AC 117 ms
4,380 KB
testcase_05 AC 110 ms
4,380 KB
testcase_06 AC 41 ms
4,376 KB
testcase_07 AC 40 ms
4,380 KB
testcase_08 AC 141 ms
4,384 KB
testcase_09 AC 143 ms
4,380 KB
testcase_10 AC 144 ms
4,376 KB
testcase_11 AC 146 ms
4,384 KB
testcase_12 AC 144 ms
4,380 KB
testcase_13 AC 136 ms
4,376 KB
testcase_14 AC 130 ms
4,376 KB
testcase_15 AC 125 ms
4,376 KB
testcase_16 AC 135 ms
4,376 KB
testcase_17 AC 131 ms
4,380 KB
testcase_18 AC 134 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

template<typename T>
vector<vector<T>> vec2d(int n, int m, T v){
    return vector<vector<T>>(n, vector<T>(m, v));
}

template<typename T>
vector<vector<vector<T>>> vec3d(int n, int m, int k, T v){
    return vector<vector<vector<T>>>(n, vector<vector<T>>(m, vector<T>(k, v)));
}

template<typename T>
void print_vector(vector<T> v, char delimiter=' '){
    if(v.empty()) {
        cout << endl;
        return;
    }
    for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter;
    cout << v.back() << endl;
}

vector<int> facs(int n){
    vector<int> ans;
    for(int x = 1; x*x <= n; x++){
        if(n%x == 0){
            ans.push_back(x);
            if(x*x != n) ans.push_back(n/x);
        }
    }
    return ans;
}

int calc(int n){
    while(true){
        int d = facs(n).size();
        if(d == n) return n;
        n -= d;
    }
}

void solve(){
    int n; cin >> n;
    if(n >= 9 || n == 6 || n == 2) cout << 2 << endl;
    else cout << 1 << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    // for(int i = 1; i <= 100; i++){
    //     cout << i << ':' << calc(i) << endl;
    // }
    int t; cin >> t;
    while(t--) solve();
}
0