Блог пользователя evilbuggy

Автор evilbuggy, история, 3 года назад, По-английски

We invite you to participate in CodeChef’s Starters 14 this Wednesday, September 29th, rated for division 3 coders.

Time: 8 PM — 11 PM IST.

Joining me on the problem setting panel are:

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating.

Good Luck!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +23
  • Проголосовать: не нравится

Автор evilbuggy, история, 6 лет назад, По-английски
#include <bits/stdc++.h>

using namespace std;

bool overflow(long long int a, long long int b){
    long long int c = a*b;
    cout<<a<<" "<<b<<" "<<c<<" "<<c/a<<" "<<c/b<<endl;
    return (c/b) != a;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int a = 847288609443LL; // 3^25
    cout<<overflow(a, a)<<endl;
}

When I run the above code in my PC I get the following output...

847288609443 847288609443 6048575297968530377 7138742 7138742
1

But when I run it on codeforces I get the following output....

847288609443 847288609443 6048575297968530377 7138742 847288609443
0

What could be the problem here? Btw Why c/a and c/b different in codeforces output though a and b have same value?

Please help me out.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор evilbuggy, история, 6 лет назад, По-английски

Broken Profile DP

My first blog post :) Any constructive feedback is welcome.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +34
  • Проголосовать: не нравится