結果
問題 | No.2649 [Cherry 6th Tune C] Anthem Flower |
ユーザー |
|
提出日時 | 2024-02-23 21:41:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 537 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 2,769 ms |
コンパイル使用メモリ | 245,632 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-29 05:58:36 |
合計ジャッジ時間 | 8,660 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll=long long;constexpr const int maxa=1000000001;ll mod(string n,ll k){int m=n.size();ll res=0;for(int i=0;i<m;i++){res=res*10+(n[i]-'0');res%=k;}return res;}int main(){int t;cin>>t;while(t--){string n;ll k;cin>>n>>k;ll ans=mod(n,2*k);cout<<((ans*(ans+1))/2)%k<<endl;}return 0;}