結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー ococonomy1ococonomy1
提出日時 2024-02-23 21:29:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,134 bytes
コンパイル時間 1,036 ms
コンパイル使用メモリ 107,956 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-23 21:29:13
合計ジャッジ時間 3,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 9 ms
6,676 KB
testcase_15 WA -
testcase_16 AC 9 ms
6,676 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 10 ms
6,676 KB
testcase_24 AC 10 ms
6,676 KB
testcase_25 WA -
testcase_26 AC 9 ms
6,676 KB
testcase_27 AC 10 ms
6,676 KB
testcase_28 AC 10 ms
6,676 KB
testcase_29 WA -
testcase_30 AC 10 ms
6,676 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
#define TEST cerr << "TEST" << endl
#define AMARI 998244353
//#define AMARI 1000000007
#define el '\n'
#define El '\n'

template <typename T> vector<T> getvec(int n,T val){
    vector<T> ans(n);
    for(int i = 0; i < n; i++){
        cin >> ans[i];
        ans[i] += val;
    }
    return ans;
}

template <typename T> void printvec(vector<T> const& a,T val){
    int n = a.size();
    for(int i = 0; i < n; i++){
        cout << (a[i] + val);
        if(i != n - 1)cout << ' ';
    }
    cout << '\n';
}

#define MULTI_TEST_CASE true 
void solve(void){
    //問題を見たらまず「この問題設定から言えること」をいっぱい言う
    //一個回答に繋がりそうな解法が見えても、実装や細かい詰めに時間がかかりそうなら別の方針を考えてみる
    //添え字回りで面倒になりそうなときは楽になる言い換えを実装の前にじっくり考える
    //ある程度考察しても全然取っ掛かりが見えないときは実験をしてみる
    //よりシンプルな問題に言い換えられたら、言い換えた先の問題を自然言語ではっきりと書く

    //n * (n + 1) / 2
    string s;
    cin >> s;
    ll m;
    cin >> m;
    ll sl = 0;
    int n = s.size();
    for(int i = 0; i < n; i++){
        sl *= 10LL;
        sl += s[i] - '0';
        sl %= m;
    }
    cout << ((sl * (sl + 1)) / 2) % m << el;
    return;
}

void calc(void){
    return;
}

signed main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    calc();
    int t = 1;
    if(MULTI_TEST_CASE)cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
0