Submission #3907734
Source Code Expand
//$g++ -std=c++11 Template.cpp
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())
using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;
ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;
int
main(void){
ios_base::sync_with_stdio(false);
ll n;
cin >> n;
int itr = 0;
ll tmp = 0LL;
while(tmp < n){
tmp = itr * (itr+1) / 2;
itr++;
}
for(int i=itr-1; i>=0; i--){
n = n - i;
if(n < 0) n = n + i;
else{
cout << i << endl;
}
if(n == 0) break;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Exactly N points |
User |
motacapla |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1661 Byte |
Status |
AC |
Exec Time |
8 ms |
Memory |
256 KB |
Judge Result
Set Name |
sample |
dataset1 |
dataset2 |
Score / Max Score |
0 / 0 |
200 / 200 |
100 / 100 |
Status |
|
|
|
Set Name |
Test Cases |
sample |
sample-01.txt, sample-02.txt, sample-03.txt |
dataset1 |
sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
dataset2 |
sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name |
Status |
Exec Time |
Memory |
01-01.txt |
AC |
1 ms |
256 KB |
01-02.txt |
AC |
1 ms |
256 KB |
01-03.txt |
AC |
1 ms |
256 KB |
01-04.txt |
AC |
1 ms |
256 KB |
01-05.txt |
AC |
1 ms |
256 KB |
01-06.txt |
AC |
1 ms |
256 KB |
01-07.txt |
AC |
1 ms |
256 KB |
01-08.txt |
AC |
1 ms |
256 KB |
01-09.txt |
AC |
1 ms |
256 KB |
01-10.txt |
AC |
1 ms |
256 KB |
02-01.txt |
AC |
8 ms |
256 KB |
02-02.txt |
AC |
8 ms |
256 KB |
02-03.txt |
AC |
8 ms |
256 KB |
02-04.txt |
AC |
8 ms |
256 KB |
02-05.txt |
AC |
8 ms |
256 KB |
02-06.txt |
AC |
5 ms |
256 KB |
02-07.txt |
AC |
4 ms |
256 KB |
02-08.txt |
AC |
8 ms |
256 KB |
sample-01.txt |
AC |
1 ms |
256 KB |
sample-02.txt |
AC |
1 ms |
256 KB |
sample-03.txt |
AC |
1 ms |
256 KB |