Mr.Adnan's blog

By Mr.Adnan, history, 5 years ago, In English

I don't know if it's an error from C++ or not.

Try this two codes: I tried to compare two string "a" and "adnan", in two codes, it giving me two different outputs, where the second one is correct.

#include<bits/stdc++.h>
using namespace std;

int main()
{
  //  cout<<("a">"adnan")<<endl;
   cout<<("a"> "adnan" ? "a": "adnan")<<endl;

}
/* The output is: 
a

which is incorrect.
*/

and

#include<bits/stdc++.h>
using namespace std;

int main()
{
   cout<<("a">"adnan")<<endl;
   cout<<("a"> "adnan" ? "a": "adnan")<<endl;


}
/* the output is:
0
adnan
*/

which is correct.

I tried from different compilers I've tested it from codechef's compiler also: c++ 14, from ideone: C++, C++ 14

And found the same error. let me know reason please.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By Mr.Adnan, history, 7 years ago, In English

Here, Uva 13043- Marbles

How to solve it?

I had an idea. As example for for 3rd case =

ans is 900C20 * 880C20 * 860C20 * 840C20 * 820C20

As the k<=50 I can do it k times By reducing X from N every time. But my this code doesn't work correctly. Help me Someone plz.

http://codepad.org/LplfZ29V

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By Mr.Adnan, history, 7 years ago, In English

Upd: [ it's ok now ]

Full text and comments »

  • Vote: I like it
  • -21
  • Vote: I do not like it