2023第十四届蓝桥杯省赛C++A组:平方差

题目很简单 直接上代码

代码

cpp 复制代码
#include<bits/stdc++.h>
using namespace std;
int main() {
	int L, R;
	cin >> L >> R;
	int count = 0;
	for (int i = L; i <= R; i++) {
		if (i % 4 != 2)
			count++;
		if (i + 4 <= R)
		{
			i += 4;
			count += 3;
		}
	}
	cout << count;
}
相关推荐
爪哇部落算法小助手7 小时前
每日两题day65
数据结构·c++·算法
麒qiqi7 小时前
【数据结构核心篇】树与哈希(Hash)的原理、特性及实战应用
数据结构·算法·哈希算法
Swift社区7 小时前
LeetCode 443. 压缩字符串
leetcode·职场和发展·蓝桥杯
ada7_7 小时前
LeetCode(python)——543.二叉树的直径
数据结构·python·算法·leetcode·职场和发展
橘颂TA7 小时前
【剑斩OFFER】算法的暴力美学——颜色分类
数据结构·c++·算法·动态规划
吴秋霖7 小时前
profileData纯算逆向分析
算法·设备指纹·反爬虫技术
sprintzer7 小时前
11.26-12.05力扣栈刷题
算法·leetcode·职场和发展
sin_hielo7 小时前
leetcode 3578
数据结构·算法·leetcode
ShiMetaPi8 小时前
SAM(通用图像分割基础模型)丨基于BM1684X模型部署指南
人工智能·算法·ai·开源·bm1684x·算力盒子
前端小白在前进8 小时前
力扣刷题:无重复字符的最长子串
算法·leetcode·职场和发展