牛客IOI周赛16-提高组a像鱼,数学
像鱼
https://ac.nowcoder.com/acm/contest/5388/A
你没有看错,只要用o(1)的时间复杂度就完事了
创作不易,点个赞呗
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod=23333333333333333;
typedef __int128 ii;
ll t,n,ans;
int main(){
for(cin>>t;t--;){
cin>>n;
ii tmp=n;
ans=(tmp+1)*tmp/6%mod;
cout<<ans<<endl;
}
return 0;
} 

查看14道真题和解析