UVA 10935 Throwing cards away I

深度学习 tesorflow2.0版本 入门第一章 为什么要学tensflow 深度学习发展迅猛 框架灵活 google开发 公司应用广泛 2.0更加灵活 后面会学习的项目 图像分类 房价预测 泰坦尼克号生存预测 文本分类 文本生成 机器翻译 核心部分 模型训练 tesorboard----> 查看模型训练进度 模型保存和部署 分布式训练-----> 加速训练速度,提升训练效率 TensorFlow常用库:Tfds, tfhub,tensor2tensor 多平台云端环境GPU:Goolgle cloud环境配置,AWS环境配置 kaggle平 阅读详情

题目链接:https://vjudge.net/problem/UVA-10935

题意:桌子上有n(n<=50)张牌,从第一张牌(即位于牌面的牌)开始,从上往下一次编号为1-n。当剩下两张牌多于两张时进行一下操作:把第一张牌扔掉,然后把新的第一张牌放到整叠牌的最后。当还剩下一张牌的时候,停止操作。

Sample Input
7
19
10
6
0
Sample Output
Discarded cards: 1, 3, 5, 7, 4, 2
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 4, 8, 12, 16, 2, 10, 18, 14
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 2, 6, 10, 8
Remaining card: 4
Discarded cards: 1, 3, 5, 2, 6
Remaining card: 4

这题的输出要注意格式,逗号后面有空格,冒号后面没有空格。

然后就是特别注意一点是当n=1的时候,应该输出Discarded cards:(此处没有空格)Remaining card: 1(有空格)

用一个数组模拟的,方法简单就不多讲了

#include <stdio.h>
int a[1005];
int main() {
	int n;
	while(~scanf("%d",&n) && n) {
		if(n == 1) {
			printf("Discarded cards:\n");
			printf("Remaining card: 1\n");
			continue;
		}
		for(int i = 0; i < n; i++) {
			a[i] = i+1;
		}
		printf("Discarded cards: ");
		for(int i = 0; i < n; i++) {
			printf("%d",a[i]);
			a[n++] = a[i+1];
			i++;
			if(i != n-2) printf(", ");
			else {
				printf("\n");
				break;
			}
		}
		printf("Remaining card: %d\n",a[n-1]);
	}
	return 0;
}


实战教程:用YOLOv11+PyQt5打造工地安全帽检测系统(附完整数据集) 本文提供了一份完整的实战指南,详细介绍了如何利用YOLOv11目标检测模型与PyQt5界面库,从零开始构建一个智能工地安全帽检测桌面应用。内容涵盖高质量数据集的准备与标注、YOLOv11模型训练与调优,以及如何使用PyQt5开发流畅、专业的图形用户界面,最终实现一个可实际部署的AI安全监控系统。 阅读详情

相关推荐

Verilog实现SPI通信协议驱动设计

线性序列机实现SPI协议

H19981118的博客 6085

【 UVA - 10935 】Throwing cards away I (卡片游戏) deque双端队列

题目链接 代码: #include <iostream> #include <algorithm> #include <queue> using namespace std; int main() { int n; while(cin>>n && n) { deque<int> q; for(int i=1;i<=n;i++) //先把1-n放入双端队列中 q.push_back(i); cout&lt

黑桃 289

c# 开发串口调试助手 Visual Studio 2019

串口调试助手是用于在开发、测试和调试串口通信应用程序时进行串口数据的监视和交互的工具。

2301_76792852的博客 8060

UVA - 10935——Throwing cards away 【队列,模拟】

Given is an ordered deck of n cards numbered 1to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:         T...

xiang_hehe的博客 231

spring-ai学习(四)-MCP

创建一个springai项目1.依赖。

zql1455890112的博客 1386

从桨叶设计到电机匹配:手把手教你调出无人机最佳动力组合

本文系统介绍了无人机动力系统的核心匹配原则,重点解析了如何通过测试与数据分析,优化螺旋桨与电机的组合,从而显著提升系统力效与续航。文章提供了从参数解读、实战测试到深度调优的完整指南,帮助开发者解决电机过热、推力不足等常见问题,实现无人机性能最大化。

weixin_29305313的博客 242

扔纸牌[Throwing cards away,UVa10935]

题目描述 桌子上一叠纸牌,一共有N张,从上到下编号依次为1~N(顶部的编号为1,底部的编号为N)。 只要这叠纸牌至少还有两张牌时,就会执行以下操作: 扔掉顶部的那张牌,然后把现在位于顶部的牌移动到这叠牌的底部。 你的任务是:当只剩下一张牌时,输出扔掉的牌的编号序列以及最后剩下的牌的编号 输入格式 输入有多行,每行一个整数N,表示这叠纸牌的张数(N≤50) 当输入为一行“0”时,表示输入结束 输出格式 对于每一个输入N,输出两行(参考输出样例) 第一行表示过程中扔掉的纸牌的编号序列 第二行表示最后剩下的牌的编

Norajiao的博客 974

PCL 点云拟合 最小二乘法拟合平面

在点云处理领域,最小二乘法(Least Squares)拟合是一种常用的数学方法,用于估计数据点的最佳拟合曲线或平面。平面拟合广泛应用于点云数据处理中的地面检测、物体表面分析等任务。 本文将介绍如何使用PCL库实现基于最小二乘法的平面拟合算法,通过拟合点云数据中的平面,来提取出数据的平面部分。

纵马踏花向自由 1026

UVa 10935 - Throwing cards away I

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=836&page=show_problem&problem=1876 思路:按照要求更改,打印数组即可,注意n=1依旧需要"Discarded cards:"。 #include #include #include

migo_dab的博客 260

SpringBoot 整合Jasypt 实现配置文件加密读取操作详解

SpringBoot 整合Jasypt 实现配置文件加密读取操作详解

congge 4100

把核心变干净的代价与回报:为什么推动 Clean Core,几乎绕不开 SAP Integration Suite 与 API Management

Clean Core的核心价值在于构建可持续升级的ERP系统架构,其关键不在于减少代码或限制扩展,而是通过解耦和治理实现系统边界的清晰划分。这一理念将推动企业从传统的"私搭乱建"式集成向平台化工程转型,而SAP Integration Suite和API Management正是实现这一转型的核心组件。 Integration Suite作为集成中枢,通过统一平台、可复用内容库和事件驱动架构,将碎片化连接转变为标准化能力;API Management则负责建立接口治理体系,通过统一入口、

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 243

2016山东省赛H题

/************************************************************************* > File Name: 山东H.cpp > Author:HaoWei > Mail:liang199611@outlook.com > Created Time: 2016年06月07日 星期二 16时20分50秒 ********

lianghaowei的博客 413

pytorch实现基本的logistic和softmax回归实验(手动+torch)

前提:不是前馈神经网络,没有隐藏层。 一:Logistic回归实验–人工构造数据集,手动构造模型 要求: 动手从0实现logistic回归,实现二分类,人工构造数据集,并分析loss、训练集、测试集的准确率。(要求从零实现二元交叉熵) 实验过程: 1.1人工构造数据集 1. # #自定义数据---训练集 2. num_inputs = 2 3. n_data = torch.ones(1500, num_inputs) # 数据的基本形态 4. x1 = torch.normal(2 * n_d

qq_37534947的博客 1万+

UVA - 10935 Throwing cards away I 【queue】

Description Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the d...

一定要站在自己热爱的生活里闪闪发光 3万+

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

UVA 10935 - Throwing cards away I

Problem B: Throwing cards away I Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at

1482

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...

Throwing cards away I UVA - 10935

题目链接:https://cn.vjudge.net/problem/UVA-10935 为什么出这么奇怪的测试点。。。。 代码: #include &amp;lt;bits/stdc++.h&amp;gt; using namespace std; int main() { freopen(&quot;i.txt&quot;, &quot;r&quot;, stdin); int n; while(cin &a

qq_43185391的博客 150

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

UVa 10935 Throwing cards away I

题目大意: 题目链接 注释代码: 无注释代码: 单词解释: trailing:

源代码 621

Uva 10935 Throwing cards away I

Throwing cards away I Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Description Given is an ordered deck of n cards numbered 1to n with

菜鸟起飞的平台 375

UVa 10935 Throwing cards away I 卡片游戏 题解

英文 Description Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in ...

ZJ_MRZ的博客 542

Throwing cards away I(UVA 10935)

似乎也没必要专门写一个函数。倒是输出格式一直没搞好。

Fool256353的博客 415

UVA10935 Throwing cards away I 卡片游戏 解题报告

桌上有n(n≤50)张牌,从第一张牌(即位于顶面的牌)开始,从上往下依次编号为1~n。当至少还剩下两张牌时进行以下操作:把第一张牌扔掉,然后把新的第一张牌放到整叠牌的最后。输入每行包含一个n,输出每次扔掉的牌以及最后剩下的牌。题目怎么说你就怎么做,非常直球,很显然是维护一个队列。

qq_45554473的博客 493

UVA10935 Throwing cards away I【模拟+queue+循环队列】

Given is an ordered deck of n cards numbered 1to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:        Thr...

海岛Blog 2532

Uva10935 - Throwing cards away I

一.题目 题目链接:Uva10935 二.思路 典型的队列,对于每次的排,把第一个pop出来输出,第二个pop出来重新push进队尾,只剩1张牌的时候结束,注意只有一张牌时候的情况,详情看代码注释。 三.源代码 #include #include using namespace std; int main() { queue cards; //用队列做容器 int n, t

CSerwangjun的博客 379

UVA-10935 Throwing cards away I

Vjudge题目链接,STL的队列,模拟队列即可,注意输入n=1的情况(坑点,每行首尾没空格)。 #include<cstdio> #include<iostream> #include<queue> using namespace std; int main(){ int n; while(~scanf("%d", &n) &&...

good vegetable! 228
上一篇: UVA 1594 Ducci Sequence
下一篇: UVA 10763 Foreign Exchange
追逐星辰的光
博客等级 码龄10年 12粉丝 221原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值