結果

問題 No.1918 Simple Math ?
ユーザー SSRSSSRS
提出日時 2022-04-29 22:12:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 367 bytes
コンパイル時間 1,409 ms
コンパイル使用メモリ 163,800 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-11 13:27:52
合計ジャッジ時間 10,162 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
8,760 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 910 ms
4,380 KB
testcase_07 AC 807 ms
4,376 KB
testcase_08 AC 450 ms
4,380 KB
testcase_09 AC 170 ms
4,376 KB
testcase_10 AC 1,971 ms
4,376 KB
testcase_11 AC 55 ms
4,376 KB
testcase_12 AC 17 ms
4,376 KB
testcase_13 AC 132 ms
4,376 KB
testcase_14 AC 8 ms
4,380 KB
testcase_15 AC 187 ms
4,380 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int T;
  cin >> T;
  for (int i = 0; i < T; i++){
    long long a, N;
    cin >> a >> N;
    long long mx = sqrt(a * N);
    long long ans = 0;
    for (long long j = 1; j <= mx; j++){
      ans += N - (j * j - 1) / a;
      ans %= MOD;
    }
    cout << ans << endl;
  }
}
0