014-12352-08-NURSULTAN-'s blog

By 014-12352-08-NURSULTAN-, history, 8 years ago, In English

Hello Codeforces! Yeah... I have a bit problem about "problemset".One of the problem is that. . And my code is that..

input:35
my output:3.43597e+010
real output:33940307968

I know it works by Big Integer.But I don't know how it works.Who gives advices?Please!

| Write comment?
»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

To eliminate this problem use "fixed". Like

cout << fixed << somenumber;
»
8 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

Declare like that.


long long a[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496LL, 8485076992LL, 16970153984LL, 33940307968LL}; int main() { cin >> n; cout << a[n]; }
  • »
    »
    8 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Sorry, but you have a mistake: 4096*2=8192 and so on. 16384, 32768, 65536 etc.

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I dont see any mistakes. https://oeis.org/A221180

      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        Oh, sorry, I think that it was just powers of 2.

        • »
          »
          »
          »
          »
          8 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          This sequence was used in recent april's fool contest, so that might be the reason he used it as an example.

    • »
      »
      »
      8 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      No man. It is Leonardo Da Vinci's Powers. Not powers of 2.

      So that, it is April Fools Day problem. )