Submission #19723706


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
using mint = modint1000000007;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo 2e18
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*
100 
100/9 = 11 > 9だからみる価値なし?
100/10
100/11 = 9...1
100/12 = 

19
24
49
99
商が、1~root(N)まで?
1あまり1=99
2あまり2=98/2=49
*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N;
  cin >> N;
  ll ans = 0;
  for(ll i=1; i*i<N; i++){ // あまりをひいている。
    ll n = N-i;
    if (n%i == 0){
      if (n/i == i) continue;
//      cout << n/i << endl;
      ans += n/i;
    }
  }
  cout << ans << endl;
}

Submission Info

Submission Time
Task D - DivRem Number
User merhorn
Language C++ (GCC 9.2.1)
Score 500
Code Size 989 Byte
Status AC
Exec Time 23 ms
Memory 3696 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, rand_10.txt, rand_11.txt, rand_12.txt, rand_13.txt, rand_14.txt, rand_15.txt, rand_16.txt, rand_17.txt, rand_18.txt, rand_19.txt, rand_20.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 6 ms 3692 KB
hand_02.txt AC 2 ms 3612 KB
hand_03.txt AC 22 ms 3640 KB
rand_01.txt AC 14 ms 3612 KB
rand_02.txt AC 14 ms 3616 KB
rand_03.txt AC 21 ms 3548 KB
rand_04.txt AC 14 ms 3548 KB
rand_05.txt AC 19 ms 3532 KB
rand_06.txt AC 18 ms 3488 KB
rand_07.txt AC 12 ms 3624 KB
rand_08.txt AC 9 ms 3688 KB
rand_09.txt AC 16 ms 3688 KB
rand_10.txt AC 13 ms 3548 KB
rand_11.txt AC 3 ms 3548 KB
rand_12.txt AC 2 ms 3540 KB
rand_13.txt AC 2 ms 3544 KB
rand_14.txt AC 3 ms 3612 KB
rand_15.txt AC 4 ms 3552 KB
rand_16.txt AC 4 ms 3660 KB
rand_17.txt AC 2 ms 3696 KB
rand_18.txt AC 3 ms 3536 KB
rand_19.txt AC 2 ms 3696 KB
rand_20.txt AC 1 ms 3552 KB
sample_01.txt AC 2 ms 3548 KB
sample_02.txt AC 23 ms 3616 KB