Just another WordPress.com site

Difficulty Level : এর চেয়ে সোজা সমস্যা আমি এই জীবনে দেখি নাই ।
Technique :
         Simulating the function is too slow (for Java at least), but if you test it out on a few small numbers, you’ll notice a pattern:

f91() returns 91 for all numbers <= 100, so just output 91, or n-10 as necessary.

Code :

#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
    int N;
    while( cin>>N && N!=0)
    {
        if(N<=100)
           printf(“f91(%d) = 91\n”,N);
        else
           printf(“f91(%d) = %d\n”,N,N-10);
    }
    return 0;
}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: