1 solutions

  • 0
    @ 2025-11-5 19:35:23

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
    int s,b,i,n,m,p;
    int main(){
    	scanf("%d%d%d",&n,&m,&p);
    	b=gcd(n,m)+gcd(abs(p-n),m)+p;
    	s=(p*m)/2;
    	i=s-b/2+1;
    	printf("%d",i);
    }
    

    Pascal :

    begin end.
    
    • 1

    Information

    ID
    19426
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By