Posts

Codeforces Solution 82A Double Cola

Image
#include <iostream> using namespace std ; int main () { int n , c = 0 ; cin >> n ; while ( n > 5 ) { n = n / 2 ; n -= 2 ; } if ( n == 1 ) cout << "Sheldon" << endl ; else if ( n == 2 ) cout << "Leonard" << endl ; else if ( n == 3 ) cout << "Penny" << endl ; else if ( n == 4 ) cout << "Rajesh" << endl ; else if ( n == 5 ) cout << "Howard" << endl ; return 0 ; }

Codeforces Solution 501A Contest

Image
#include <iostream> #include <algorithm> using namespace std ; int main () { long long int a , b , c , d , ma , mb ; cin >> a >> b >> c >> d ; ma = max ((( 3 * a )/ 10 ), a -(( a / 250 )* c )); mb = max ((( 3 * b )/ 10 ), b -(( b / 250 )* d )); if ( ma == mb ) cout << "Tie" << endl ; else if ( ma > mb ) cout << "Misha" << endl ; else cout << "Vasya" << endl ; return 0 ; }

library Management System

Image
#include<bits/stdc++.h> #include<windows.h> using namespace std; int com,l,temp,te,t=0,f,k=0,p,day,month,year,day1,month1,year1,fi,gi,v,go=0,in=0,li[100]; string ch; ofstream outl; class book { protected:     int id_book[1000],number_of_books[1000],d;     string book_name[1000],author_name[1000]; public:     void updatebook()     {         ofstream outfile;         outfile.open("input00.dat",ios::app);         outl.open("input5.dat");         cout<<"How Many Book You Want To Entry:"<<endl;         cin>>d;         for(int i=1; i<=d; i++)         {             cout<<"Enter book id number: ";             cin>>id_book[i];             cin.ignore();             outfile<<id_book[i]<<endl;             cout<<"Enter Books name: ";             cin>>book_name[i];             cin.ignore();             outfile<<book_name[i]<<endl;        

Codeforces solution 112A Petya and Strings

Image
#include <stdio.h> int main () { int n ; char a [ 200 ], b [ 200 ]; gets ( a ); gets ( b ); n = strcmpi ( a , b ); printf ( "%d\n" , n ); return 0 ; }

Codeforces Solution 230B T-primes

Image
#include < bits / stdc ++. h > using namespace std ; int arr [ 10000000 ]; int main () { int i , j ; arr [ 0 ]= arr [ 1 ]= 1 ; for ( i = 2 ; i * i <= 10000000 ; i ++) { if ( arr [ i ]== 0 ) { for ( j = 2 ; i * j <= 10000000 ; j ++) { arr [ i * j ]= 1 ; } } } int n , t ; cin >> n ; long long int in ; for ( int i = 0 ; i < n ; i ++) { cin >> in ; t = sqrt ( in ); if ( t == sqrt ( in )&& arr [ t ]== 0 ) { cout << "YES" << endl ; } else cout << "NO" << endl ; } return 0 ; }

Uri Solution 1387 Og

Image
#include<stdio.h> int main() {     int a,b;     while(1)     {       scanf("%d %d",&a,&b);       if(a==0 && b==0)       {           break;       }       printf("%d\n",a+b);     }     return 0; }