出题人说正解为RMQ,鄙人实在太蒟蒻了,不会呀只能暴力……
#includeusing namespace std;#define ll long long#define re registerconst int N=1e6+10;const int mod=1e9+7;void read(int &a){ a=0; int d=1; char ch; while(ch=getchar(),ch>'9'||ch<'0') if(ch=='-') d=-1; a=ch-'0'; while(ch=getchar(),ch>='0'&&ch<='9') a=a*10+ch-'0'; a*=d;}void write(int x){ if(x<0) putchar(45),x=-x; if(x>9) write(x/10); putchar(x%10+'0');}int a[N];int GCD(int a,int b){ return b==0?a:GCD(b,a%b);}int main(){ int n; read(n); ll ans=0,gcd; read(a[0]); gcd=a[0]; for(re int i=1;i