diff --git a/UPCODER/Other/HSG#01.cpp b/UPCODER/Other/HSG#01.cpp new file mode 100644 index 00000000..3bb310e6 --- /dev/null +++ b/UPCODER/Other/HSG#01.cpp @@ -0,0 +1,46 @@ +#include +#include +#include + +using namespace std; +using namespace __gnu_pbds; + +#define endl '\n' +#define int long long +#define inp freopen("file.inp", "r", stdin) +#define out freopen("file.out", "w", stdout) +#define TIME 1.0*clock()/CLOCKS_PER_SEC +#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr) +template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; +template using ordered_map = tree, rb_tree_tag, tree_order_statistics_node_update>; + +const int MAXN = 1e6 + 5; +const int MOD = 1e9 + 7; + +int sum(int n) { + int res = 0; + for (int i = 1; i <= n/2; i++) + if (n % i == 0) + res += i; + return res; +} + +signed main() { + fastIO; + int n; + cin >> n; + + n++; + while (true) { + int s = sum(n); + + if (s > n) { + cout << n; + break; + } + + n++; + } + + return 0; +} \ No newline at end of file