Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:45
Show Gist options
  • Save pinglunliao/cce3426d12ff4b51f8bf to your computer and use it in GitHub Desktop.
Save pinglunliao/cce3426d12ff4b51f8bf to your computer and use it in GitHub Desktop.
#include <cmath>
#include <cstdio>
using namespace std;
int main(void){
int n,m;
while(scanf("%d %d", &n, &m) != EOF)
{
int sum = n;
int cnt = 1;
for(int t = n + 1; sum <= m; t++)
{
cnt ++;
sum += t;
}
printf("%d\n", cnt);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment