1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
   | #include<bits/stdc++.h> using namespace std; #define int long long #define itn long long #define x first #define fst ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define y second const int N=1e6+5,INF=0x3f3f3f3f3f3f3f3f; string s1,s2,s3,s4; string s; char c1,c2; string S1,S2,S3,S4; string a1,a2; signed main(){ 	freopen("output.in","r",stdin); 	freopen("output.out","w",stdout); 	int ans=0; 	cin>>s; 	cin>>s1>>c1>>s2>>s3; 	cin>>S1>>c2>>S2>>S3; 	cin>>a1>>a2; 	int a=0,b=0,c=0,d=0,e=0,f=0; 	int i; 	int t=1; 	for(i=6;s3[i]!=',';i++){ 		if(s3[i]=='-'){t=-1;continue;} 		a=a*10+(s3[i]-'0'); 	} 	a*=t;t=1;i++; 	for(;s3[i]!=',';i++){ 		if(s3[i]=='-'){t=-1;continue;} 		b=b*10+(s3[i]-'0'); 	} 	b*=t;t=1;i++; 	for(;s3[i]!=')';i++){ 		if(s3[i]=='-'){t=-1;continue;} 		c=c*10+(s3[i]-'0'); 	} 	c*=t;t=1; 	for(i=6;S3[i]!=',';i++){ 		if(S3[i]=='-') 		{ 			t=-1;continue; 		} 		if(S3[i]==c1) 		{ 			d=-1919810; 			continue; 		} 		d=d*10+(S3[i]-'0'); 	} 	d*=t;t=1;i++; 	for(;S3[i]!=',';i++){ 		if(S3[i]=='-') 		{ 			t=-1;continue; 		} 		if(S3[i]==c1) 		{ 			e=-1919810; 			continue; 		} 		e=e*10+(S3[i]-'0'); 	} 	e*=t;t=1;i++; 	for(;S3[i]!=')';i++){ 		if(S3[i]=='-') 		{ 			t=-1;continue; 		} 		if(S3[i]==c1) 		{ 			f=-1919810; 			continue; 		} 		f=f*10+(S3[i]-'0'); 	} 	f*=t;t=1; 	if(c<0) 	{ 		t=-1; 	} 	for(int i=a;i*t<b*t;i+=c) 	{ 		int d1,e1; 		if(d==-1919810)d1=i; 		else 		{ 			d1=d; 		} 		if(e==-1919810)e1=i; 		else 		{ 			e1=e; 		} 		int o=1; 		if(d1>e1)o=-1; 		 		 			 		 		if((f<0&&d1>e1)||(f>0&&d1<e1))ans+=(d1+((e1-d1-1)/f)*f+d1)*((e1-d1-1)/f+1)/2; 	} 	cout<<ans<<endl; 	return 0; }
   |