結果

問題 No.1844 Divisors Sum Sum
ユーザー boatmuscles
提出日時 2022-02-18 21:58:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 119 ms / 3,000 ms
コード長 432 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 37,504 KB
最終ジャッジ日時 2025-01-28 00:00:46
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d", &L);
      |     ~~~~~^~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d %d", &P, &E);
      |         ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<cstdio>
#include<atcoder/modint>
using namespace atcoder;
using Mint = modint1000000007;
int main(){
    int L;
    scanf("%d", &L);
    Mint answer = Mint::raw(1);
    for (int _ = 0; _ < L; _++)
    {
        int P, E;
        scanf("%d %d", &P, &E);
        answer *= (Mint::raw(P)*(Mint::raw(P).pow(E+1) - Mint::raw(1)) - Mint::raw(P-1)*Mint::raw(E+1))/(Mint::raw(P-1).pow(2));
    }
    printf("%u\n", answer.val());
}
0