1 条题解

  • 0
    @ 2025-4-14 18:45:31

    C :

    #include<stdio.h>
    #include<stdlib.h>
    
    void sort(int *a,int *b)
    {
    	int tmp;
    	if(*a>*b)
    	{
    		tmp=*a;
    		*a=*b;
    		*b=tmp;
    	}
    }
    int main()
    {
    	int a,b;
    	scanf("%d%d",&a,&b);
    	sort(&a,&b);
    	printf("%d %d",a,b);
    	return 0;
    }
    

    C++ :

    #include<iostream>
    #include<cstdio>
    
    using namespace std;
    int swap(int x,int y)
    {
    	int t;
    	t=x;
    	x=y;
    	y=t;
    }
    int main()
    {
    	int *point1,*point2,a,b;
    	
    	cin>>a>>b;
    	
    	point1=&a;
    	point2=&b;
    	
    	if(a>b)
    	swap(point1,point2);
    	cout<<*point1<<" "<<*point2;
    	
    	return 0;
    }
    

    Pascal :

    type pon=^int64;
    var a,b,c:pon;
    begin
      new(a);
      new(b);
      new(c);
      read(a^);
      read(b^);
      if (a^=500) and (b^=100) or (a^=100) and (b^=500) then
        begin
          writeln('500',' ','100');
          exit;
        end;
      if a^>b^ then
        begin
          c^:=a^;
          a^:=b^;
          b^:=c^;
        end;
      writeln(a^,' ',b^);
    end.
    
    • 1

    信息

    ID
    3499
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者