1 条题解

  • 0
    @ 2025-4-12 21:41:02

    C :

    #include<stdio.h>
    
    int main()
    {
    	int tmp=1,max=0;
    	while(scanf("%d",&tmp)!=EOF)
    	{
    		
    		if(tmp>max)
    		{
    			max=tmp;		
    		}
    		if(tmp==0)
    		{
    			printf("%d\n",max);
    			max=0; 
    		}
    	}
    	return 0;
    }
    

    C++ :

    #include<stdio.h>
    int max(int a,int b)
    {
    	return a>b?a:b;
    }
    int main()
    {
    	int maxnum=0,temp;
    	while(scanf("%d",&temp)!=EOF)
    	{
    		maxnum=temp;
    		while(scanf("%d",&temp)!=EOF&&temp)
    		{
    			maxnum=max(maxnum,temp);
    		}
    		printf("%d\n",maxnum);
    	}
    	return 0;
    }
    

    Pascal :

    var a,b,c,d,e:integer;
    begin
     while not eof do
     begin
       e:=-999;
        a:=1;
    while a<>0 do
    begin
      read(a);
      if a>e then e:=a;
    end;
    writeln(e);
    end;
    end.
    
    • 1

    信息

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