1 条题解

  • 0
    @ 2021-6-15 10:13:23

    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

    信息

    ID
    442
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者