Please sign in first.
Submission #67531635
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#define ALL(v) v.begin(),v.end()
#define For(i,_) for(int i=0,i##end=_;i<i##end;++i) // [0,_)
#define FOR(i,_,__) for(int i=_,i##end=__;i<i##end;++i) // [_,__)
#define Rep(i,_) for(int i=(_)-1;i>=0;--i) // [0,_)
#define REP(i,_,__) for(int i=(__)-1,i##end=_;i>=i##end;--i) // [_,__)
typedef long long ll;
typedef unsigned long long ull;
#define V vector
#define pb push_back
#define pf push_front
#define qb pop_back
#define qf pop_front
#define eb emplace_back
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
#define fi first
#define se second
const int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}},inf=0x3f3f3f3f,mod=998244353;
const ll infl=0x3f3f3f3f3f3f3f3fll;
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,1:0;}
int init=[](){return cin.tie(nullptr)->sync_with_stdio(false),0;}();
int main(){
int t_case=1;
// scanf("%d",&t_case);
while(t_case--){
ll n;
scanf("%lld",&n);
__int128 ans=(__int128)n*(n+1)/2;
for(ll i=1;i<=n;){
ll j=n/i,k=n/j;
ans-=__int128(k-i+1)*j;
i=k+1;
}
printf("%d\n",int(ans%mod));
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Count A%B=C |
| User | zzr |
| Language | C++ 20 (gcc 12.2) |
| Score | 475 |
| Code Size | 1367 Byte |
| Status | AC |
| Exec Time | 18 ms |
| Memory | 3896 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:31:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%lld",&n);
| ~~~~~^~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 475 / 475 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-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, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3756 KiB |
| 00-sample-02.txt | AC | 1 ms | 3600 KiB |
| 00-sample-03.txt | AC | 13 ms | 3684 KiB |
| 01-01.txt | AC | 1 ms | 3664 KiB |
| 01-02.txt | AC | 1 ms | 3896 KiB |
| 01-03.txt | AC | 1 ms | 3820 KiB |
| 01-04.txt | AC | 1 ms | 3752 KiB |
| 01-05.txt | AC | 1 ms | 3660 KiB |
| 01-06.txt | AC | 1 ms | 3752 KiB |
| 01-07.txt | AC | 1 ms | 3740 KiB |
| 01-08.txt | AC | 1 ms | 3748 KiB |
| 01-09.txt | AC | 1 ms | 3764 KiB |
| 01-10.txt | AC | 1 ms | 3820 KiB |
| 01-11.txt | AC | 1 ms | 3760 KiB |
| 01-12.txt | AC | 1 ms | 3744 KiB |
| 01-13.txt | AC | 1 ms | 3892 KiB |
| 01-14.txt | AC | 1 ms | 3648 KiB |
| 01-15.txt | AC | 18 ms | 3824 KiB |
| 01-16.txt | AC | 18 ms | 3644 KiB |
| 01-17.txt | AC | 18 ms | 3832 KiB |
| 01-18.txt | AC | 18 ms | 3596 KiB |
| 01-19.txt | AC | 18 ms | 3752 KiB |
| 01-20.txt | AC | 18 ms | 3896 KiB |
| 01-21.txt | AC | 18 ms | 3872 KiB |
| 01-22.txt | AC | 18 ms | 3896 KiB |
| 01-23.txt | AC | 18 ms | 3664 KiB |
| 01-24.txt | AC | 18 ms | 3684 KiB |
| 01-25.txt | AC | 18 ms | 3824 KiB |
| 01-26.txt | AC | 18 ms | 3656 KiB |
| 01-27.txt | AC | 18 ms | 3664 KiB |
| 01-28.txt | AC | 1 ms | 3696 KiB |
| 01-29.txt | AC | 1 ms | 3828 KiB |
| 01-30.txt | AC | 1 ms | 3740 KiB |
| 01-31.txt | AC | 1 ms | 3600 KiB |
| 01-32.txt | AC | 1 ms | 3664 KiB |
| 01-33.txt | AC | 1 ms | 3876 KiB |
| 01-34.txt | AC | 1 ms | 3604 KiB |
| 01-35.txt | AC | 1 ms | 3828 KiB |
| 01-36.txt | AC | 1 ms | 3600 KiB |
| 01-37.txt | AC | 1 ms | 3600 KiB |
| 01-38.txt | AC | 2 ms | 3596 KiB |
| 01-39.txt | AC | 2 ms | 3684 KiB |
| 01-40.txt | AC | 2 ms | 3764 KiB |
| 01-41.txt | AC | 2 ms | 3820 KiB |
| 01-42.txt | AC | 13 ms | 3872 KiB |
| 01-43.txt | AC | 14 ms | 3752 KiB |
| 01-44.txt | AC | 4 ms | 3668 KiB |
| 01-45.txt | AC | 17 ms | 3684 KiB |
| 01-46.txt | AC | 7 ms | 3816 KiB |
| 01-47.txt | AC | 1 ms | 3828 KiB |
| 01-48.txt | AC | 9 ms | 3896 KiB |
| 01-49.txt | AC | 4 ms | 3648 KiB |
| 01-50.txt | AC | 12 ms | 3600 KiB |
| 01-51.txt | AC | 13 ms | 3744 KiB |
| 01-52.txt | AC | 3 ms | 3660 KiB |
| 01-53.txt | AC | 16 ms | 3760 KiB |