結果

問題 No.1201 お菓子配り-4
ユーザー mlihua09mlihua09
提出日時 2020-08-28 22:37:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 809 ms / 4,000 ms
コード長 347 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 76,368 KB
最終ジャッジ日時 2024-11-14 01:27:48
合計ジャッジ時間 10,739 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #


N = int(input())

M = int(input())

A = list(map(int, input().split()))

a = sum(A)

ans = 0

from math import gcd

P = 10 ** 9 + 7

for b in map(int, input().split()):
    
    x = 0
    
    for i in A:
        
        g = gcd(i, b)
        
        x -= b - g
        
    x += a * (b + 1)
    
    ans += x
    
    ans %= P
    
print(ans)
0