Thursday, July 20, 2017

1785. Lost in Localization Timus Problem Solution & LOgic

http://acm.timus.ru/problem.aspx?space=1&num=1785

এটা শুধু  if & else if  এর খেলা ছাড়া আর কিছুই নয়।

প্রশ্নের টেবিলের শরতগুলো  if & else if  ব্যবহার করে সাজিয়ে ফেলো , তাই হবে - চলো কোড দেখি


#include<bits/stdc++.h>

using namespace std;

//Nayeem Mollick Joy ,Applied Physics & Electronic Engineering ,University of Rajshahi.


   int main()
{
  int n;
  while(cin>>n)
  {
      if(n>=1&&n<=4)
      {
          cout<<"few"<<endl;
      }
      else if((n>=5&&n<=9))
      {
          cout<<"several"<<endl;
      }
      else if(n>=10&&n<=19)
      {
          cout<<"pack"<<endl;
      }
      else if((n>=20&&n<=49))
      {
          cout<<"lots"<<endl;
      }
      else if(n>=50&&n<=99)
      {
          cout<<"horde"<<endl;
      }
      else if(n>=100&&n<=249)
      {
          cout<<"throng"<<endl;
      }
      else if(n>=250&&n<=499)
      {
          cout<<"swarm"<<endl;
      }
      else if(n>=500&&n<=999)
      {
          cout<<"zounds"<<endl;
      }
      else if(n>=1000&&n<=2000)
      {
          cout<<"legion"<<endl;
      }
  }
  return 0;
}




  




















                                                                                                                                                                                                               

No comments:

Post a Comment