結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー chro_96
提出日時 2024-02-23 21:55:57
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-29 06:28:13
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

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