<cf>B. Magic Forest

1.5元主控搞定高精度电流电压采集?STC8G1K08+INA180A3硬件设计全解析 本文详细解析了如何利用成本仅1.5元的STC8G1K08单片机与INA180A3电流检测放大器,构建一套高精度、低成本的电流电压采集系统。文章深入剖析了硬件设计精髓,包括利用MCU内部上拉电阻直驱数码管以节省成本、INA180A3的配置与计算,以及实现高频率采集并与上位机高速通信的软件策略,为嵌入式开发中的极致性价比设计提供了完整方案。 阅读详情


time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Imp is in a magic forest, where xorangles grow (wut?)

A xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the lengths is equal to zero. Imp has to count the number of distinct xorangles of order n to get out of the forest.

Formally, for a given integer n you have to find the number of such triples (a, b, c), that:

  • 1 ≤ a ≤ b ≤ c ≤ n;
  • , where denotes the bitwise xor of integers x and y.
  • (a, b, c) form a non-degenerate (with strictly positive area) triangle.
Input

The only line contains a single integer n (1 ≤ n ≤ 2500).

Output

Print the number of xorangles of order n.

Examples
Input
6
Output
1
Input
10
Output
2
Note

The only xorangle in the first sample is (3, 5, 6).

异或三角形(应该这么叫吧 )....... >O(n^2)直接便利就好 数据2500而已

#include<iostream>
using namespace std;
typedef long long ll ;
#define f(i,l,r) for(int i=l;i<=r;++i)
#define g(i,l,r) for(int i=l;i>=r;--i)





int main(){
	int n ;
	int ans= 0;

	cin>>n;
	f(i,1,n)
		f(j,i+1,n){
			int m = i^j;   
			if(m>=1&& m <=n&&m>j&&i+m>j&&j+m>i&&i+j>m)
				ans++;
	}
	cout<<ans<<endl;
}


未来的我一定会感谢正在努力的现在的我!


ubuntu18.04安装gtsam过程及报错error: invalid initialization of reference of type ‘const std::vector<bool>&’ 这里建议从这个链接下,不要从官网下,可能会有版本冲突 2.安装依赖 3.编译 报错: 1. error: invalid initialization of reference of type ‘const std::vector&’ from expression of type ‘const std::vector’ 124 | const std::vector& mask() const { retur... 阅读详情

相关推荐

学习Ultralytics (下载)

Ultralytics由创立,最初是为了简化目标检测模型的开发和应用,专注于构建高效、易用、性能卓越的深度学习框架。其主要产品之一是 YOLO 系列模型,尤其是最新的YOLOv5和YOLOv8,因其在精度、速度和可扩展性方面的出色表现而广受欢迎。

2301_76846375的博客 2864

922B. Magic Forest

B. Magic Forest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Imp is in a magic forest, where xorangles gr

memory_qianxiao的博客 580

Python爬虫实战:5分钟搞定大众点评评论数据抓取(附完整代码)

本文详细介绍了使用Python爬虫高效获取大众点评评论数据的5个关键技巧,包括环境配置、智能页面解析、反反爬策略、数据存储与容错设计以及性能优化。通过实战案例和完整代码,帮助开发者快速掌握文本挖掘技术,适用于市场分析和商业决策。

weixin_30660027的博客 290

codeforces 922 B. Magic Forest(枚举、位运算(异或))

题目链接:点击打开链接 Imp is in a magic forest, where xorangles grow (wut?) A xorangle of ordernis such a non-degenerate triangle, that lengths of its sides are integers not exceedingn, and the xor-...

weixin_30426065的博客 186

STM32 FOC电机控制:手把手教你用CubeMX配置TIM1中心对齐PWM(含代码避坑)

本文详细解析了STM32 FOC电机控制中TIM1中心对齐PWM的配置方法,涵盖CubeMX图形化设置、HAL库代码调用及常见问题排查。特别针对L6230Q驱动芯片的使能逻辑和死区时间配置提供实用指南,帮助开发者高效实现无刷电机的高性能控制。

weixin_27027459的博客 442

什么是无人机电源管理模块?电源管理模块有什么用处?

我来描述一下我的问题情景,电源管理模块的定义是,这里给出这个PX4官方对于电源管理模块的一些介绍,补充一下锂电池的放电原理大家就可以更好理解为什么需要电源管理模块

HRWVY0725的博客 2273

CodeForces 922B Magic Forest(暴力)

B. Magic Foresttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImp is in a magic forest, where xorangles grow (wut?)A xorangle of order n is such a...

kolmikl 257

ROS与UR10e机械臂实战:从零搭建到精准控制

本文详细介绍了如何从零开始搭建ROS与UR10e机械臂的开发环境,包括硬件准备、软件配置、网络设置以及MoveIt!运动控制实战。通过具体的代码示例和常见问题排查,帮助开发者快速掌握UR10e机械臂的精准控制技术,适用于工业自动化和实验室研究场景。

m3n5b7v8c9x的博客 772

【CodeForces - 922B 】Magic Forest (数学,异或,暴力,水题,三元组问题)

题干: Imp is in a magic forest, where xorangles grow (wut?) A xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the le...

xuanweiace的博客 858

USB2.0信号完整性测试之眼图

名称线缆颜色引脚描述红色绿色白色GND黑色。

qq_53766840的博客 3286

世界职业院校技能大赛财经赛道项目参考逐字稿五

世界职业院校技能大赛财经赛道项目参考逐字稿五

我是网络安全兼技能大赛工程师,专注网络安全技术学习与技能大赛实战!持续分享最新的技术文章,帮你少走弯路,一起在技术赛道上进步~ 134

Codeforces Round #461 (Div. 2) B. Magic Forest(异或的性质)

描述 Imp is in a magic forest, where xorangles grow (wut?) A xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-su...

riba2534的博客 658

Debezium报错处理系列之第112篇:Cannot replicate because the master purged required binary logs. Replicate the

Debezium报错处理系列之第112篇:Cannot replicate because the master purged required binary logs.

zhengzaifeidelushang的博客 726

CodeForces 922B Magic Forest 打表

Magic Forest 我们注意到n的上界是2500,n³=1.5625e10,n³÷1e8≈156s。如果暴力打表,可以在三分钟内完成统计。 我们对1≤n≤2500预处理打表,将结果保存在常量数组中,直接输出答案即可。 (0ms过题法对于数据范围不严的题目作用极佳) 代码: #include<cstdio> using namespace std; const long ...

caiyiwen's ACM/ICPC Zone 744

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Magic Forest

Code Forces-922B点击打开链接 思路:遍历所有的a,b组合,算出c,如果c<=n,并且a+b<c(也就是可以组成不共线的三角形),即满足条件。 #include<iostream> #include<cstring> using namespace std; const int MAX=2505; int main() { int n,a...

ricyyy的博客 553

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

WOJ1041-Magic Forest

MagicForest has many trees, such as linetree , suffix-tree , red-black tree.... Do you master all the trees? But don't worry, in this problem I will not talk about trees.Instead, I am going to introd

LXQ1071717521的博客 1620

F - Magic Forest 异或思维

传送门 思维:异或的性质 a ^ a =0. 那么必然有i ^ j = k. k = k ^ 0; 那么程序可以优化到O2。 #include<iostream> #include<cmath> using namespace std; int main() { int n; cin >> n; int cnt = 0; for(...

weixin_43960370的博客 321

CF922B Magic Forest

CF922B Magic Forest 题意翻译 题目大意 给定一个正整数nn,求满足如下条件的三元组(a,b,c)(a,b,c)的个数: 1 \le a \le b \le c \le n1≤a≤b≤c≤n a \space xor \space b \space xor \space c=0axorbxorc=0 存在一个边...

HJ921004的博客 424

Codeforces 922B Magic Forest

题意:给定一个NNN,问你能找到多少个三元组(a,b,c)(a,b,c)(a,b,c),满足1≤a≤b≤c≤N1≤a≤b≤c≤N1\leq a \leq b \leq c \leq N且a⊕b⊕c=0a⊕b⊕c=0a\oplus b\oplus c= 0 思路:直接暴力即可 #include&lt;bits/stdc++.h&gt; using namespace std; typede...

宝树啊宝树 411

【Unity 背景素材包】Background Pack 02 - Magic Forest 提供了丰富的魔法森林场景,适用于角色扮演游戏、冒险游戏、休闲游戏等类型

Background Pack 02 - Magic Forest 是一款专为 Unity 开发的背景素材包,提供了丰富的魔法森林场景,适用于角色扮演游戏、冒险游戏、休闲游戏等类型。该资源包以梦幻、神秘的森林景观为主题,拥有多种幻想风格的背景元素,帮助开发者快速构建充满魔法氛围的游戏世界。

2403_88403568的博客 1346

hdu 4941Magic Forest离散化

题意:

suyuxuan94的专栏 461

CF div2 B. Magic Forest

B. Magic Forest time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Imp is in a magic forest, where xorangles grow (wut?)A xorangle of order n

fbher的博客 233

【CodeForce】【位运算】【map】922 B Magic Forest

【题目】http://codeforces.com/problemset/problem/922/B 【题意】从1-n取三个不同的数,组成一个a^b^c=0的三角形,问能组成多少个 【思路】枚举a,b,c=a^b^0;最后去重。 【代码】 #include&lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; c...

swqeaaa的博客 236

CodeForces - 922B Magic Forest(水题)

#include&amp;lt;bits/stdc++.h&amp;gt; #define maxn 10010 using namespace std; int n,a,b,c,k,ans; int pd(int i,int j,int k){ return i+j&amp;gt;k ; } int main(){ ans=0; scanf(&quot;%d&quot;,&amp;amp;n); for(int i...

xx_ii 268
上一篇: <Newcoder> n方格染色问题
下一篇: <cf>C. Cave Painting
PragIncor
博客等级 码龄9年 1粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值