ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1639. Chocolate 2

Bu.......
Posted by Nargiza Asqarova 1 Dec 2011 17:50
 xatosi qayerda bilasizmi?

 var m,n:1..50;
   begin
   read(m,n);
   if odd(m*n)then write('[second]:=]')
   else write('[:=[first]');
  end.
Re: Bu.......
Posted by Zaripova Aziza 8 Dec 2011 19:08
var a,n,m:word;
begin
a:=m*n-1;
if a mod 2=0  then
writeln('[second]=:]') else
writeln('[:=[first]');readln;
readln;end.
Re: Bu.......
Posted by choriyev bekzod 8 Dec 2011 19:15
#include <stdio.h>
void main()
{
int n,m;
scanf("%d %d",&m,&n);
printf("%s",(m*n%2)?"[second]=:]":"[:=[first]" );
}
hojiyevsunatullo_1991@mail.ru
Posted by Sunnat 8 Dec 2011 19:20
men paskallni yaxshi tushunmiyman C++ da kod quyidagicha yozilgan:


#include<iostream>
using namespace std;
int main()
{
    int n,m,s1=0,s2=0,i=0;
    cin>>n>>m;
    while(i==0)
    {
       if(n%2==0||m%2==0)
       {
           if(n%2==0&&m%2==0)
           {
                if(n>m)n=n/2;
                else m=m/2;
           }
           else if(n%2==0)n=n/2;
           else m=m/2;
           s1+=n*m;
        }
        else
        {
        s1+=1;
        s2+=n*m-1;
        n=0;m=0;i=1;
        }

      //------------------------------------------------
        if(n%2==0||m%2==0)
        {
           if(n%2==0&&m%2==0)
           {
                if(n>m)n=n/2;
                 else m=m/2;
           }
           else if(n%2==0)n=n/2;
           else m=m/2;
           s2+=n*m;
         }
         else
         {
            s2+=1;
            s1+=n*m-1;
             n=0;m=0;i=1;
         }

    }
    if(s1>=s2)cout<<"[:=[first]";
    else cout<<"[second]=:]";
    return 0;
}
Re: hojiyevsunatullo_1991@mail.ru
Posted by Muhammad 13 Nov 2020 16:42
//javada  ,in java

import java.util.Scanner;
public class ONETHOUSANDTWO {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int s1 = 0, s2 = 0, i = 0;
        if ((m * n - 1) % 2 == 0) {
            System.out.println();
        }

        while(i==0)
        {
            if(n%2==0||m%2==0)
            {
                if(n%2==0&&m%2==0)
                {
                    if(n>m)n=n/2;
                    else m=m/2;
                }
                else if(n%2==0)n=n/2;
                else m=m/2;
                s1+=n*m;
            }
            else
            {
                s1+=1;
                s2+=n*m-1;
                n=0;m=0;i=1;
            }

            //------------------------------------------------
            if(n%2==0||m%2==0)
            {
                if(n%2==0&&m%2==0)
                {
                    if(n>m)n=n/2;
                    else m=m/2;
                }
                else if(n%2==0)n=n/2;
                else m=m/2;
                s2+=n*m;
            }
            else
            {
                s2+=1;
                s1+=n*m-1;
                n=0;m=0;i=1;
            }

        }
        if (s1>=s2) System.out.println("[:=[first]");
        else System.out.println("[second]=:]");
    }
}
Sunnat wrote 8 December 2011 19:20
men paskallni yaxshi tushunmiyman C++ da kod quyidagicha yozilgan:


#include<iostream>
using namespace std;
int main()
{
    int n,m,s1=0,s2=0,i=0;
    cin>>n>>m;
    while(i==0)
    {
       if(n%2==0||m%2==0)
       {
           if(n%2==0&&m%2==0)
           {
                if(n>m)n=n/2;
                else m=m/2;
           }
           else if(n%2==0)n=n/2;
           else m=m/2;
           s1+=n*m;
        }
        else
        {
        s1+=1;
        s2+=n*m-1;
        n=0;m=0;i=1;
        }

      //------------------------------------------------
        if(n%2==0||m%2==0)
        {
           if(n%2==0&&m%2==0)
           {
                if(n>m)n=n/2;
                 else m=m/2;
           }
           else if(n%2==0)n=n/2;
           else m=m/2;
           s2+=n*m;
         }
         else
         {
            s2+=1;
            s1+=n*m-1;
             n=0;m=0;i=1;
         }

    }
    if(s1>=s2)cout<<"[:=[first]";
    else cout<<"[second]=:]";
    return 0;
}