結果

問題 No.2940 Sigma Sigma Div Floor Problem
ユーザー zazaboonzazaboon
提出日時 2024-10-18 23:24:33
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 6,000 ms
コード長 4,026 bytes
コンパイル時間 2,893 ms
コンパイル使用メモリ 169,064 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-18 23:24:45
合計ジャッジ時間 11,252 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,816 KB
testcase_05 AC 2 ms
6,816 KB
testcase_06 AC 2 ms
6,820 KB
testcase_07 AC 2 ms
6,816 KB
testcase_08 AC 2 ms
6,816 KB
testcase_09 AC 1 ms
6,816 KB
testcase_10 AC 2 ms
6,816 KB
testcase_11 AC 2 ms
6,816 KB
testcase_12 AC 2 ms
6,816 KB
testcase_13 AC 2 ms
6,816 KB
testcase_14 AC 2 ms
6,820 KB
testcase_15 AC 2 ms
6,816 KB
testcase_16 AC 2 ms
6,820 KB
testcase_17 AC 4 ms
6,820 KB
testcase_18 AC 20 ms
6,820 KB
testcase_19 AC 16 ms
6,816 KB
testcase_20 AC 15 ms
6,816 KB
testcase_21 AC 25 ms
6,816 KB
testcase_22 AC 6 ms
6,820 KB
testcase_23 AC 8 ms
6,820 KB
testcase_24 AC 13 ms
6,816 KB
testcase_25 AC 14 ms
6,816 KB
testcase_26 AC 18 ms
6,820 KB
testcase_27 AC 2 ms
6,820 KB
testcase_28 AC 26 ms
6,816 KB
testcase_29 AC 27 ms
6,816 KB
testcase_30 AC 3 ms
6,816 KB
testcase_31 AC 8 ms
6,816 KB
testcase_32 AC 4 ms
6,816 KB
08_evil_01.txt TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

//solve atcoder problem
//memo:for (const auto &e : e) {
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define foreach(e, m) for (const auto &(e) : (m))
#define ll long long
#define ldf long double
#define flout std::fixed << std::setprecision(15) << 
#define txt freopen("wormsort.in", "r", stdin), freopen("wormsort.out", "w", stdout);
#define dmap unordered_map 
#define dmin(x) *min_element(begin(x), end(x))
#define dmax(x) *max_element(begin(x), end(x))
#define huge 4e18
#define intbig (ll)2e9
#define vec2(t) vector<vector<t>>
#define vec3(t) vector<vector<vector<t>>>
#define bit(x) (1LL << (x))
#define r_up(x, y) (((x) + (y) - 1) / (y))
#define jun_end(a) } while (next_permutation(a.begin(), a.end()));
#define pll pair<ll, ll>

// #define __popcnt __builtin_popcount
// #define __popcnt64 __builtin_popcountll

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <array>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <sstream>
#include <map>
#include <random>
#include <unordered_map>
#include <cassert>
#include <bit>
#include <cstdint>

using namespace std;

const ll MOD = 1e9 + 7;
const ll MOD9 = 998244353;

vector<ll> inp() { string input;getline(cin,input);stringstream ss(input);vector<ll> result;ll number;while(ss >> number) { result.push_back(number); }return result; }
map<ll,ll> tally(vector<ll>& a) { map<ll,ll> h;for(ll i = 0; i < a.size(); i++) { h[a[i]]++; }return h; }
ll gcd(ll a,ll b) { if(b == 0) { return a; }return gcd(b,a % b); }
ll modpow(ll a,ll n,ll mod) { ll res = 1;while(n > 0) { if(n & 1) { res = res * a % mod; }a = a * a % mod;n >>= 1; }return res; }
ll lcm(ll a,ll b) { return a / gcd(a,b) * b; }
ll kaijo(ll n,ll mod) { ll res = 1;for(ll i = 1; i <= n; i++) { res *= i;res %= mod; }return res; }
ll comb(ll n,ll k,ll mod) { ll res = 1;for(ll i = 1; i <= k; i++) { res *= n - i + 1;res %= mod;res *= modpow(i,mod - 2,mod);res %= mod; }return res; }
ll isqrt(ll n,bool f = false) { if(n == 1) { return 1; }ll a = sqrtl(n + 1);if(a * a > n) { a--; }if(f) { if(a * a != n) { return a + 1; } }return a; }
template<typename TTM>
TTM sum(vector<TTM> a) { TTM sum = 0;for(ll i = 0; i < a.size(); i++) { sum += a[i]; }return sum; }
vector<vector<ll>> matrix_mul(vector<vector<ll>>& a,vector<vector<ll>>& b,ll mod) { ll n = a.size();ll m = a[0].size();ll l = b[0].size();vector<vector<ll>> c(n,vector<ll>(l,0));for(ll i = 0; i < n; i++) { for(ll j = 0; j < l; j++) { for(ll k = 0; k < m; k++) { c[i][j] += a[i][k] * b[k][j];c[i][j] %= mod; } } }return c; }
vector<ldf> inpf() { string input;getline(cin,input);stringstream ss(input);vector<ldf> result;ldf number;while(ss >> number) { result.push_back(number); }return result; }
ll s_maxop(ll a,ll b) { return max(b,a); }
ll s_maxe() { return 0; }
template<typename TM>
vector<TM> csum(vector<TM>& a,bool f = false) { vector<TM> res(a.size() + 1,0);for(ll i = 0; i < a.size(); i++) { res[i + 1] = res[i] + a[i]; }if(f) { res.erase(res.begin()); }return res; }
template<typename TMR>
vector<TMR> colum(vector<vector<TMR>>& a,ll col) { ll n = a.size();vector<TMR> res(0);for(ll i = 0; i < n; i++) { res.push_back(res[i][col]); }return res; }
template<typename TRR>
vector<TRR> p_col(vector<pair<TRR,TRR>>& a,bool f = true) { ll n = a.size();vector<TRR> res(0);for(ll i = 0; i < n; i++) { if(f) { res.push_back(a[i].first); } else { res.push_back(a[i].second); } }return res; }

/*
ll dfs(ll x,ll prev) {
	rep(i, links[x].size()) {
		ll y = links[x][i];
		if(y == prev) {
			continue;
		}
		dfs(y,x);
	}
	return 0LL;
}
*/

ll n,x;
vec2(ll) datas;

vector<vector<ll>> links;
// must use int not ll
// intを使わないように注意!
int main()
{
	ll n;
	cin >> n;
	ll ans = 0;
	rep(j,n + 1) {
		if(j==0) { continue; }
		ll len = (n-j+1)/j;
		if(len > 0) {
			ans += (1+len)*len/2*j;
		}
		ans += (n-j+1-len*j) * (n / j);
		ans %= 998244353;
	}
	cout << ans;
	return 0;
}

/*test case
1
2 5
0 5
5

*/
0