1 solutions

  • 0
    @ 2025-11-5 19:41:49

    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

    Information

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