1 solutions

  • 0
    @ 2025-11-5 18:05:16

    C :

    #include<stdio.h>
    #include<string.h>
    #include<math.h>
    int main(){
    int N;
    while(scanf("%d",&N)!=EOF){
    int i,t,s1=0,s2=0;
    for(i=0;i<2*N;i++){
        scanf("%d",&t);
    if(i%2) s1+=t;
    else s2+=t;}
    if(s1!=s2) printf("YES\n");
    else printf("NO\n");}
    return 0;}
    

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int n,x,ou,ji;
    int main()
    {   
    	cin>>n;
    	for(int i=0;i<2*n;i++)
    	{
    		cin>>x;
    		if(i%2==0) ou+=x;
    		else ji+=x;
    	}
    	if(ji!=ou) cout<<"YES";
    	else cout<<"NO";
    	return 0;    
    }
    
    

    Pascal :

    var a:array[1..201] of longint;
        x,maxi,i,s1,s2:longint;
    begin
     readln(x);
     maxi:=1;
     for i:=1 to x*2 do
     begin
      read(a[i]);
      if i mod 2=1 then inc(s1,a[i]) else inc(s2,a[i]);
      if a[i]>a[maxi] then maxi:=i;
     end;
     if maxi mod 2=1 then
      if s1<=s2 then writeln('NO')
                else writeln('YES')
      else if s2<=s1 then writeln('NO')
                     else writeln('YES');
    end.
    
    • 1

    Information

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