結果

問題 No.2480 Sequence Sum
ユーザー otamay6otamay6
提出日時 2023-09-22 21:55:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 2,009 ms
コンパイル使用メモリ 197,348 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 21:55:43
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    // j*i + k*(i+1) = Nであるi,j,k > 0の組
    // (n-ji)/(i+1)が正整数であるi,jの組
    // あるiに対してj ≡ -N (mod i+1)であるjの数
    int n; cin>>n;
    ll res = 0;
    rep(i, 1, sqrt(n+1)){
        ll mod_j = (i+1) - n % (i+1);
        ll j_max = n/i;
        res += (j_max - mod_j) / (i+1);
    }
    cout << res << endl;
}
0