draid's blog

By draid, history, 4 days ago, In English

i was trying to solve this cool cses problem the other minute and i stumbled across a problem relating modulo: im pretty sure there is nothing wrong with my usage of spoiler dirichlet's hyperbola method, basically what i did was computing the first two sums modulo M then subtracting the last chunk modulo then modulo the actual result applying the rule (a mod m) — (b mod m) mod m = (a — b mod m), but there is a case when b mod m is just greater than a mod m and not b > a, i don't know what to do! can anyone please correct my usage of modulo! thanks in advance :3

#include <bits/stdc++.h>

using namespace std;
#define int unsigned long long

int G(int n) {
  return n*(n+1)/2;
}

signed main() {
  int n; cin >> n;
  int res = 0, MOD = 1e9 + 7, t = (int)sqrt(n);
  for(int i = 1; i <= t ; i++) {
    res += G(n/i)%MOD;
    res += (i * (n/i))%MOD;
    res %= MOD;
  }

  res -= (G(t)*t)%MOD;
  res %= MOD;
  cout << res;
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By draid, history, 2 weeks ago, In English

i've spent the last 3 months doing projecteuler, learned a lot of stuff, things such as dirichlet's hyperbola method, pell's equations, generating functions... it was a wonderful journey! i just felt like sharing this, pretty proud of myself! :3

Full text and comments »

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

By draid, history, 6 weeks ago, In English

today, i was hit with 0 points in the finals of the national IOI selection contest, well, it was expected since im a newbie, but i wasn't ready, i spent this entire year knowing what cp is, seeing others getting higher in their cp ranks, being the one people laughed at, im arrogant, i can't accept the fact that who once i were better than, are slowly but definitely becoming better than me, couldn't participate in their discussions, i was always a "algorithm x? yeah fancy way of saying backtracking, ha!" type of person in discussions, i was, and still, an arrogant person, as of writing this im full of jealousy towards those who will go the IOI, we were just trolling together the other month, or year... i hate what i've became, depression is tearing me apart, i want to be a better, non-trolling version of myself, it's only me who can decide with actions, to be a better version, a version that others actually respect, a version that can make it to the IOI, someone told me a statement that stuck with me, "you are only 15, even if you fucked this year you still have two tries!", well, although this statement is true, i don't want to go to the IOI at my current state, i don't want to shame my country nor my self, comparing my current self to my last year self doesn't form a huge difference, although i did know what cp is and practiced lightly, i'd say apart from my physical growth, you won't be able to tell difference between the two, i have to take action and stop using my environment or whatever as an excuse for my slow progress, i have people who are waiting patiently for the day when i'll be able to provide to them, and wanting the best for me, i want to make it to the IOI sooner than later, this can only be done by proving my existence in codeforces/projecteuler (or not, but that's another debate :3), i will do my best, i promise you curious reader! i don't like stating goals so let it be... (up/down)vote this as you want, i just want this to be here, i need too, im sick of myself and i need to be not urgently, it's summer in my country, and i have 85 days left.

Full text and comments »

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