結果

問題 No.3388 Sum of Function
コンテスト
ユーザー Germanium32
提出日時 2025-11-20 18:09:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 194,868 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-28 20:54:55
合計ジャッジ時間 2,684 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
	int a,b; cin>>a>>b;
	int ans=0;
	for(int i=a; i<b+1; i++){
		if(i==2){
			ans+=7;
		}
		else if(i==3){
			ans+=22;
		}
		else if(i==5){
			ans+=106;
		}
		else if(i==7){
			ans+=302;
		}
		else if(i==1){
			
		}
		else{
			if(i%2!=0 && i%3!=0){
				if(i%5!=0 && i%7!=0){
					ans+=i*i*i-i*i+i+1;
				}
			}
		}
	}
	cout<<ans<<endl;
}
0