結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー chro_96
提出日時 2024-02-23 21:51:58
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-09-29 06:18:37
合計ジャッジ時間 2,938 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 += m;
    ans *= (ans+1LL);
    ans /= 2LL;
    printf("%lld\n", ans%m);
    t--;
  }
  
  return 0;
}
0