結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
コンテスト
ユーザー chro_96
提出日時 2024-02-23 21:48:11
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 470 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 164 ms
コンパイル使用メモリ 38,080 KB
最終ジャッジ日時 2026-02-22 11:33:28
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main () {
  int t = 0;
  char n[4000001] = "";
  long long m = 0LL;
  
  int res = 0;
  
  res = scanf("%d", &t);
  while (t > 0) {
    long long ans = 0LL;
    int idx = 0;
    res = scanf("%s", n);
    res = scanf("%lld", &m);
    while (n[idx] != '\0') {
      ans *= 10LL;
      ans += (long long)(n[idx]-'0');
      ans %= m;
      idx++;
    }
    ans *= (ans+1LL);
    ans /= 2LL;
    printf("%lld\n", ans%m);
    t--;
  }
  
  return 0;
}
0