Cutting Game FZU - 2268 (找规律题,二进制,n最少分出几段,组成小于等于n任意数)

Jetson工业级应用指南:用Orin NX 16GB打造多摄像头AI质检系统 本文详细介绍了如何利用NVIDIA Jetson Orin NX 16GB构建高效的多摄像头AI质检系统,涵盖硬件选型、软件优化及产线部署全流程。通过100 TOPS的AI算力和多路视频处理能力,Orin NX在工业4.0时代展现出卓越的实时缺陷检测性能,特别适合嵌入式AI应用场景。 阅读详情

Fat brother and Maze are playing a kind of special (hentai) game with a piece of gold of length N where N is an integer. Although, Fat Brother and Maze can buy almost everything in this world (except love) with this gold, but they still think that is not convenient enough. Just like if they would like to buy the moon with M lengths of the gold, the man who sold the moon need to pay back Fat Brother and Maze N-M lengths of the gold, they hope that they could buy everything they can afford without any change. So they decide to cut this gold into pieces. Now Fat Brother and Maze would like to know the number of the pieces they need to cut in order to make them fulfill the requirement. The number of the gold pieces should be as small as possible. The length of each piece of the gold should be an integer after cutting.

Input

The first line of the data is an integer T (1 <= T <= 100), which is the number of the text cases.

Then T cases follow, each case contains an integer N (1 <= N <= 10^9) indicated the length of the gold.

Output

For each case, output the case number first, and then output the number of the gold pieces they need to cut.

Sample Input
1
3
Sample Output
Case 1: 2
Hint

In the first case, the gold can be cut into 2 pieces with length 1 and 2 in order to buy everything they can afford without change.


题意:t组数据,每组数据,一个数n,表示长度为n的黄金,下面求n至少分成几段,使得 分成的几段能 组成 小于等于n的任意数;

其实:从写出 1~10的分法,就能找到规律了;

其实就是二进制位 也可以说就位二进制就分成几段,8 分成 1,2,4,1  9分成 1,2,4,2  10分成 1,2,4,3  把小于它位数的二进制全部分出(因为 7 的二进制为全为1 ,所以 只能分出 1,2,4,等于他的位数) 如 10 分出的为 1,2,4  ;这时小于等于7的数,全部能组成了,那么大于7的部分呢? 既然你组成 小于等于7的所有数, 那么 让 n - 1~7 中的数一定全部包含 大于 7的数;  

代码:

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define Max 100010
#include<math.h>
#define ll long long 
int sum[40];

int main()
{
	int i,j;
	int t;
	
	for(i = 0;i<=30;i++)
	{
		if(i == 0)
			sum[i] = 1;
		else sum[i] =(int)pow(2,i);
	}
	scanf("%d",&t);
	int pp = 1;
	while(t--)
	{
		int n;
		scanf("%d",&n);
		for(i = 0;i<=30;i++)
		{
			n -= sum[i];
			if(n<=0)
				break;
		}
		printf("Case %d: ",pp++);
		printf("%d\n",i+1);
	}
	return 0;
}

“反激电源”是AC/DC隔离电源还是DC/DC隔离电源? 所以在一些场景,我们的输入电压是一个DC,但是我们仍然需要隔离电源的需求,我们就会只采用图9.2的右半部分。在这个场景下“反激电源”是DC/DC。所以此AC/DC的本质是将AC变成高压的DC之后,用带隔离变压器的反激式开关电源产生一个隔离的、稳定的直流电压。一般在讲述各种电源的拓扑的文章和书籍都是在讲述AC/DC的电源拓扑分类的时候,讲述Flyback。反激式开关电源是指使用反激高频变压器隔离输入输出回路的开关电源,反激式隔离变压器开关电源重点表述的是开关电源包含变压器的拓扑结构。 阅读详情

相关推荐

阿里云大模型ACP认证模拟考试(二)

摘要:在阿里云大模型高级工程师 ACP 认证暂无真题题库的现状下,模拟题具有重要意义。其依照真实考试设计,涵盖题型、题量与分值分布,助力考生熟悉考试框架,合理分配答题时间精力,提升效率。同时,模拟题紧扣官方课程,能帮助考生精准定位知识盲点,如大模型架构原理和通义千问应用实践等重点内容,以便针对性完善知识体系。此外,通过练习模拟题,考生可掌握不同题型的解题思维与技巧,快速洞察复杂题目本质,提高答题准确率。

davidkorhenn的博客 2074

FZU_Problem 2151 OOXX Game

Problem 2151 OOXX Game Accept: 476    Submit: 730 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai) game on

有一种力量叫乐观 1680

Unity 多线程编程笔记 _Task详解

士大夫

weixin_43405845的博客 4384

FZU2268 Cutting Game(数学,规律)(第七届福建省大学生程序设计竞赛)

题目: Problem 2268 Cutting Game Accept: 10    Submit: 12 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of special (hentai

riba2534的博客 1583

孤读paper——《GhostNet:More Features from Cheap Operations》

《GhostNet:More Features from Cheap Operations》   发现一个点并解决就是一篇CVPR,该文章主要发现了优秀的网络的特点是feature map提取过程中的冗余性,这种冗余性体现在很多成对的feature map间很像,就好像彼此的“ghost”,而这种特征冗余性对于理解图像来说还是必要的,所以文章把feature map分为两种,一种是本质特征,一...

雄关漫道真如铁 而今迈步从头越 5151

Java与OSG的梦幻联动:深入编译OpenSceneGraph的Java JNI桥梁,开启3D视觉盛宴的奇幻之旅

🔥关注墨瑾轩,带你探索编程的奥秘!🚀🔥超萌技术攻略,轻松晋级编程高手🚀🔥技术宝库已备好,就等你来挖掘🚀🔥订阅墨瑾轩,智趣学习不孤单🚀🔥即刻启航,编程之旅更有趣🚀在编译OpenSceneGraph (OSG) 的Java版本时,首先需要了解OSG本身是一个主要用于3D图形和视觉仿真的开源库,它主要支持C++。然而,OSG 也支持通过JNI(Java Native Interface)与Java集成,这允许Java程序调用OSG的C++库。

java专栏 869

Cutting Game FZU - 2268 (数学+二进制)

Cutting Game FZU - 2268 Fat brother and Maze are playing a kind of special (hentai) game with a piece of gold of length N where N is an ...

codeswarrior的博客 313

再不入坑就晚了,深度神经网络概念大整理,最简单的神经网络是什么样子?

再不入坑就晚了,深度神经网络概念大整理,最简单的神经网络是什么样子?

我是香菜 3万+

H补题

 H - A-B Game Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2147 Description

袁汉春 765

强化学习从基础到进阶-案例与实践[4]:深度Q网络-DQN、double DQN、经验回放、rainbow、分布式DQN

强化学习从基础到进阶-案例与实践[4]:深度Q网络-DQN、double DQN、经验回放、rainbow、分布式DQN

丨汀、的博客 2066

【STK】手把手教你利用STK进行进行光电红外仿真02-STK/EOIR模块属性之一 传感器选项设置

EOIR传感器可以从空间几何属性、光谱属性、光学属性、辐射属性四个方面进行设置,并且可以设置信号传播路径中的大气特性,包括大气模型、气溶胶模型、气象学可见性和大气湿度。在定义EOIR传感器时,需要Sensor——Definition属性页中,将Sensor Type设置为EOIR。单击下面的按钮打开传感器的EOIR配置页,可以对传感器的属性进行配置,此外,还可以在场景中视情况添加相关的中心体。路径辐射损耗影响上述特性的计算,计算的结果考虑了传感器、目标位置的影响,但是还没考虑地球临边背景的影响。

weixin_44184852的博客 3200

第7届福建省赛练习赛

A - Card Game (First Edition)   Fat brother and Maze are playing a kind of special (hentai) game with some cards. There are N*2 cards in this game for the players to use, this is the c

干掉学霸我称王的博客 580

汽车ECU诊断刷写和OTA升级中的验签和校验

汽车ECU诊断刷写和OTA升级中的验签和校验

天赐好车的博客 617

FZU-2147-2147 A-B Game,规律题。。

Problem 2147 A-B Game Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game by two integers A and B. First F...

weixin_30679823的博客 204

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

FZU_2147_A-B_GAME

/* Problem Description Fat brother and Maze are playing a kind of special (hentai) game by two integers A and B. First Fat brother write an integer A on a white paper and then Maze start to change t

TwinklingZ 598

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

FZU2264,2265,2266 Card Game 系列 (数学,规律)(第七届福建省大学生程序设计竞赛)

题目: Problem 2264 Card Game (First Edition) Accept: 5    Submit: 17 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fat brother and Maze are playing a kind of spe

riba2534的博客 1766

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

fzu-2266

C - Card Game (Third Edition)   Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card deck

yu121380的博客 488

Cutting Game FZU - 2268 (思维)

Fat brother and Maze are playing a kind of special (hentai) game with a piece of gold of length N where N is an integer. Although, Fat Brother and Maze can buy almost everything in this world (except...

码农的一亩三分地 413

FZU-Problem 2150 Fire Game

Problem 2150 Fire Game Accept: 392 Submit: 1502 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N

有一种力量叫乐观 2371

fzu 2150 Fire Game(BFS)

Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just em

青山绿水之辈 专栏 4368

找规律,二进制

题解:列出从0到n的二进制,然后观察一下,我们会们发现在从右到左第一位所有数对答案的贡献是n,第二位n/2,第三位n/(2*2),第四位是n/(2*2*2),然后规律就有了,写一个循环就行了。 AC代码: #include <bits/stdc++.h> using namespace std; typedef long long LL; void solve(){ LL a; scanf("%lld", &a); LL ans = 0; for(in..

Alanrookie的博客 360

FZU 2150 Fire Game

Problem 2150 Fire Game Accept: 1344    Submit: 4753 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game on a

你真的介意真的在乎真的想要真的渴望的话你一定能够做到 509

FZU2264 Card Game (First Edition)(数论&规律)

Fat brother and Maze are playing a kind of special (hentai) game with some cards. There are N*2 cards in this game for the players to use, this is the card deck. The game goes for N rounds and in each...

UncleJokerly 404

Card Game (Third Edition) FZU - 2266

Card Game (Third Edition) FZU - 2266 Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, eve...

codeswarrior的博客 522

Problem 2150 Fire Game

Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just em

xiaofang3a的专栏 661

FZU 2268 Cutting Game

http://acm.fzu.edu.cn/problem.php?pid=2268#include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;cstring&gt; #define iloveu return 0 #define wangxingyi main using namespace std; int wangxingyi(){...

三水的鱼塘♂ 218
上一篇: X FZU - 2271 (给出一个图,能删除至多多少边使得任意两点之间的最短路径不变)
下一篇: 2018年湘潭大学程序设计竞赛 H 统计颜色( 区间更新线段树 + 状态压缩 )
obsorb_knowledge
博客等级 码龄9年 38粉丝 213原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值