結果
| 問題 | No.682 Average | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-05-27 18:09:24 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 407 bytes | 
| コンパイル時間 | 1,191 ms | 
| コンパイル使用メモリ | 93,980 KB | 
| 最終ジャッジ日時 | 2025-01-10 15:58:18 | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b; cin >> a >> b;
	if((a+b)%3==0){
		printf("%d\n",b/3-(a-1)/3);
	}
	else{
		int p=3-(a+b)%3;
		int cnt=0;
		for(int i=a;i<=b;i++){
			if(i%3==p)cnt++;
		}
		printf("%d\n",cnt);
	}
}
            
            
            
        