Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Expected GCD
#include<bits/stdc++.h> using namespace std; #define ll long logn int #define pb push_back #define N=200000; #define mod 1000000007 int main() { int t; cin>>t; while(t--) { int n; cin>>n; int a[n],b[n]; for(int i=0;i<n;i++) cin>>a[i]>>b[i]; ll dp[N+1]={0}; for(int i=1;i<=2000000;i++) { ll p=1; for(int j=0;j<n;j++) { p=(p*(b[j]/i-(a[j]-1)/i))%mod; } dp[i]=p; } ll sum=0; for(int i=200000;i>=1;i--) { for(int j=i*2;j<=200000;j=i+j) { dp[i]-=dp[j]; } sum=(sum+i*dp[i])%mod; } } }
run
|
edit
|
history
|
help
0
Metodos 2- programa3
Double_wrapper gcc
queue
myfirst.cpp
Set of intervals.
shivratri
HeapSort
Procesos estocasticos Beta 2.0
czekolada
Float