結果

問題 No.2545 Divide by 3
ユーザー 👑 NachiaNachia
提出日時 2023-11-16 01:02:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 83,388 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-16 01:02:52
合計ジャッジ時間 1,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <atcoder/modint>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(i64 i=0; i<(i64)(n); i++)
#define repr(i,n) for(i64 i=(i64)(n)-1; i>=0; i--)
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;

bool verify(u64 x){
    vector<u64> A(4);
    A[2] = 1;
    A[1] = x;
    u64 mult = 0x2000000001 / 3;
    vector<string> Q;
    rep(d,37){
        if((mult >> d) & 1) A[3] = A[3] + A[1];
        A[1] = A[1] + A[1];
        A[3] /= 2;
        A[1] /= 2;
    }
    return A[3] == x / 3;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    u64 mult = 0x2000000001 / 3;
    vector<string> Q;
    rep(d,37){
        if((mult >> d) & 1) Q.push_back("plus 3 3 1");
        Q.push_back("plus 1 1 1");
        Q.push_back("div 3 3");
        Q.push_back("div 1 1");
    }
    cout << Q.size() << '\n';
    for(auto& q : Q) cout << q << '\n';
    return 0;
}
0