1 solutions

  • 0
    @ 2025-11-5 15:17:50

    C :

    #include<stdio.h>
    int main()
    {
    	int head, foot;
    	int x, y;
    	scanf("%d%d", &head, &foot);
    	x = (4 * head - foot) / 2;
    	y = (foot - 2 * head) / 2;
    	printf("%d %d\n", x, y);
    	return 0;
    }
    
    

    C++ :

    #include <cstdio>
    //#include <cstdlib>
    
    int main(){
      int a, b, n, m;
      scanf("%d%d", &n, &m);
      a = (4*n-m)/2;
      b = n-a;
      printf("%d %d\n", a, b);
      //system("pause");
      return 0;
    }
    
    

    Pascal :

    var i,j,k,m,n:longint;
    begin
    read(n,k);
    m:=n*4;
    i:=(m-k) div 2;
    j:=n-i;
    write(i,' ',j);
    end.
    
    
    • 1

    Information

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