UVa 10494 If We Were a Child Again (高精度)

Java utgard连接OPC问题记录 怎么开启是个问题, 是在引入openscada的jar包里的Sever类中修改,这就犯难了, 其实没必要, 只要在自己项目下创建与openscada中Server类相同的路径,并复制Server过去改就行了, 项目会优先使用本地类,像下面这样。奇迹发生了,0x00000005解决. 注: 我的安全补丁编码跟网上查到的并不一样, 所以最初没有删,后来全都删了就好了,这个编码规则咱也不知道.安全日志中记录用户登录行为, OPC通信需要使用Windows系统用户进行登录, 如果用户名密码错误这里会有相关记录. 阅读详情

10494 - If We Were a Child Again

Time limit: 3.000 seconds

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=97&page=show_problem&problem=1435

“Oooooooooooooooh!

If I could do the easy mathematics like my school days!!

I can guarantee, that I’d not make any mistake this time!!”

Says a smart university student!!

But his teacher even smarter – “Ok! I’d assign you such projects in your software lab. Don’t be so sad.”

“Really!!” - the students feels happy. And he feels so happy that he cannot see the smile in his teacher’s face.

 

 

The Problem

 

The first project for the poor student was to make a calculator that can just perform the basic arithmetic operations.

 

But like many other university students he doesn’t like to do any project by himself. He just wants to collect programs from here and there. As you are a friend of him, he asks you to write the program. But, you are also intelligent enough to tackle this kind of people. You agreed to write only the (integer) division and mod (% in C/C++) operations for him.

 

Input

Input is a sequence of lines. Each line will contain an input number. One or more spaces. A sign (division or mod). Again spaces. And another input number. Both the input numbers are non-negative integer. The first one may be arbitrarily long. The second number n will be in the range (0 < n < 231).

 

 
Output

A line for each input, each containing an integer. See the sample input and output. Output should not contain any extra space.

 

 
 
Sample Input

110 / 100

99 % 10

2147483647 / 2147483647

2147483646 % 2147483647

 

 

 

 

 
 
Sample Output

1

9

1

2147483646


完整代码:

/*0.019s*/

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1000;///不要开太小了!

char numstr[maxn], numstr2[maxn];

struct bign
{
	int len, s[maxn];

	bign()
	{
		memset(s, 0, sizeof(s));
		len = 1;
	}

	bign(int num)
	{
		*this = num;
	}

	bign(const char* num)
	{
		*this = num;
	}

	bign operator = (const int num)
	{
		char s[maxn];
		sprintf(s, "%d", num);
		*this = s;
		return *this;
	}

	bign operator = (const char* num)
	{
		len = strlen(num);
		for (int i = 0; i < len; i++) s[i] = num[len - i - 1] & 15;
		return *this;
	}

	///输出
	const char* str() const
	{
		if (len)
		{
			for (int i = 0; i < len; i++)
				numstr[i] = '0' + s[len - i - 1];
			numstr[len] = '\0';
		}
		else strcpy(numstr, "0");
		return numstr;
	}

	///去前导零
	void clean()
	{
		while (len > 1 && !s[len - 1]) len--;
	}

	///加
	bign operator + (const bign& b) const
	{
		bign c;
		c.len = 0;
		for (int i = 0, g = 0; g || i < max(len, b.len); i++)
		{
			int x = g;
			if (i < len) x += s[i];
			if (i < b.len) x += b.s[i];
			c.s[c.len++] = x % 10;
			g = x / 10;
		}
		return c;
	}

	///减
	bign operator - (const bign& b) const
	{
		bign c;
		c.len = 0;
		for (int i = 0, g = 0; i < len; i++)
		{
			int x = s[i] - g;
			if (i < b.len) x -= b.s[i];
			if (x >= 0) g = 0;
			else
			{
				g = 1;
				x += 10;
			}
			c.s[c.len++] = x;
		}
		c.clean();
		return c;
	}

	///乘
	bign operator * (const bign& b) const
	{
		bign c;
		c.len = len + b.len;
		for (int i = 0; i < len; i++)
			for (int j = 0; j < b.len; j++)
				c.s[i + j] += s[i] * b.s[j];
		for (int i = 0; i < c.len - 1; i++)
		{
			c.s[i + 1] += c.s[i] / 10;
			c.s[i] %= 10;
		}
		c.clean();
		return c;
	}

	///除
	bign operator / (const bign &b) const
	{
		bign ret, cur = 0;
		ret.len = len;
		for (int i = len - 1; i >= 0; i--)
		{
			cur = cur * 10;
			cur.s[0] = s[i];
			while (cur >= b)
			{
				cur -= b;
				ret.s[i]++;
			}
		}
		ret.clean();
		return ret;
	}

	///模、余
	bign operator % (const bign &b) const
	{
		bign c = *this / b;
		return *this - c * b;
	}

	bool operator < (const bign& b) const
	{
		if (len != b.len) return len < b.len;
		for (int i = len - 1; i >= 0; i--)
			if (s[i] != b.s[i]) return s[i] < b.s[i];
		return false;
	}

	bool operator > (const bign& b) const
	{
		return b < *this;
	}

	bool operator <= (const bign& b) const
	{
		return !(b < *this);
	}

	bool operator >= (const bign &b) const
	{
		return !(*this < b);
	}

	bool operator == (const bign& b) const
	{
		return !(b < *this) && !(*this < b);
	}

	bool operator != (const bign &a) const
	{
		return *this > a || *this < a;
	}

	bign operator += (const bign &a)
	{
		*this = *this + a;
		return *this;
	}

	bign operator -= (const bign &a)
	{
		*this = *this - a;
		return *this;
	}

	bign operator *= (const bign &a)
	{
		*this = *this * a;
		return *this;
	}

	bign operator /= (const bign &a)
	{
		*this = *this / a;
		return *this;
	}

	bign operator %= (const bign &a)
	{
		*this = *this % a;
		return *this;
	}
} a, b;

int main(void)
{
	char op;
	while (~scanf("%s %c %s", numstr, &op, numstr2))
	{
		a = numstr, b = numstr2;
		puts(op == '/' ? (a / b).str() : (a % b).str());
	}
	return 0;
}

利用CAT12做皮层指标的统计分析及可视化笔记记录 利用CAT12做皮层指标的统计分析及可视化 文章目录利用CAT12做皮层指标的统计分析及可视化前言一、统计步骤1.Basic Models2.Estimate Surface Models3.Results二、可视化1.t值可视化2.p值可视化 前言 本来没有打算做SBM的,因为自己是新手小白,许多操作都不太懂,但最后还是打算做一下,于是就从上周末开始将很久之前跑VBM得到的surf文件夹中的数据捡起来继续做皮层分析,因为之前看了一个博主的博客,关于如何做SBM已经讲得非常清楚了,但是在统计及可视化这里,我 阅读详情

相关推荐

数据中心机房设备标签规范建议

机房的维护工作中,标识管理是极其重要的一部分,从基本的线缆上跳接信息的标识,到设备、机柜标识规范的实施,不同程度的体现了标识管理的重要作用。本规范适用于机房主设备、线缆、机柜(含PDU插排)、仪器仪表、动力配套设备(各类空调、消防设备、配电柜、UPS等设备)、网络口、电源插座口的标签、标识规定。动力设备的设备编号、设备名称、生产厂商及厂商技术支持热线、设备型号、设备序列号、设备使用部门、设备责任人、设备启用时间及设备保修年限、条形码。各类标签、标识可根据设备和机柜的尺寸、大小进行调整。

有地气的强弱电小圈子 3525

uva10494 if we were a child again

大数的相除与取余   不多说 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=1435&mosmsg=Submission+received+with+ID+13135833#include #include // 大数字符串

fisty 653

数字IC设计技能篇之如何在RTL级降低功耗?

以上就是本次降低芯片功耗的部分心得和收获,由于是在芯片设计阶段还没办法后端直接给出power的报告,前端一般使用spyglass和fsdb来进行功耗分析,后续会更新如何使用spyglass在前仿阶段进行power的分析,以及持续更新有关RTL级降低功耗的相关内容。

mzynk的博客 1202

If We Were a Child Again

Problem C If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!! I

no ACMer 715

基于STM32的多模态智能风扇控制系统设计与实现

本文详细介绍了基于STM32单片机的多模态智能风扇控制系统的设计与实现。系统集成了红外遥控、蓝牙手机控制及人体感应等多模态交互方式,通过PWM技术实现无级调速,并设计了安全优先的控制逻辑。文章从硬件选型、核心原理、软件编程到系统调试,提供了完整的实战指南,适合嵌入式开发爱好者学习与实践。

weixin_28285943的博客 238

量化交易——量化选股(多因子选股)

就是用过去的股票的收益率对多因子进行回归,得到一个回归方程,然后再把最新的因子值代入回归方程得到一个对未来股票收益的预判,然后再以此为依据进行选股。的方法是建立在市场无效或弱有效的前提之下,随着使用多因子选股模型的投资者数量的不断增加,有的因子会逐渐失效,而。就是根据各个因子的大小对股票进行打分,然后按照一定的权重加权得到一个总分,根据总分再对股票进行筛选。另一方面,一些因子可能在过去的市场环境下比较有效,而随着市场风格的改变,这些。波动的影响,避免在市场极度狂热或悲观的情况下作出非理性的。

jiucaixiuyang的博客 1787

Uva 10494 If We Were a Child Again(高精度相除)

Problem C If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!!

小G的ACM之路 1033

SUMO使用教程(一)

本人的sumo视频入门课程,希望支持哦。https://edu.youkuaiyun.com/course/detail/25834 SUMO是一款交通仿真软件,其余可自行百度。教程一主要展示一下如何运行一个仿真实例。当然,这只是实现方法中的一种。 准备: 1.SUMO软件 2.osm地图文件 SUMO可去官网下载,解压后就可以使用,图形界面软是在解压后bin文件夹下的sumo-gui.exe。...

lyx的专栏 3万+

UVA 10494 If We Were a Child Again 高精度除法简单版

这道题和之前三道高精度的题一起挂的吧,但是隔了两天才来

Gatevin的专栏 1164

(五)深入理解Bluez协议栈之“GATT Server Profile”

上一篇介绍Bluez协议栈的了GAP Profile的实现,本章节我们继续介绍GATT Profile的实现,参考的程序是Peripheral。通过阅读它的实现代码可以发现,它广播部分是通过mgmt来实现的,然后在初始化完成之后,创建了一个L2CAP类型的socket,来负责实现GATT Server的逻辑。

1142

一文讲透 SAP VDM 命名里的前缀与后缀:看懂 I_、C_、A_,把 CDS 视图栈搭得又稳又好用

SAP S/4HANA 的 CDS 视图命名规范解析 摘要:本文详细解析 SAP S/4HANA 中 CDS 视图的 VDM 命名规范。通过前缀(如 I_、C_、R_)区分视图层级,后缀标记附加角色,结合 @VDM.viewType 注解形成完整语义体系。I_作为稳定接口层,C_面向特定场景裁剪,R_限定应用域内复用,A_提供远程 API 接口。命名规范使团队能快速识别视图用途、依赖关系和扩展边界,确保模型长期可维护性。文章结合制造业物料主数据、Fiori 应用等实际案例,说明如何通过规范命名构建清晰的视图

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

If We Were a Child Again - UVa 10494 高精度

Problem C If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!! I c

提比的强行AC 826

PointNet++改进策略 :模块改进 | x-Conv | PointCNN, 结合局部结构与全局排列提升模型性能

这篇论文介绍了一种名为PointCNN的方法,旨在从点云(point cloud)数据中学习特征。传统卷积神经网络(CNN)在处理规则网格数据(如图像)时非常有效,但由于点云是无序且不规则的,直接在其上应用卷积操作会导致形状信息丢失,并对点的排列顺序敏感。为了解决这一问题,论文提出了一种X-Conv操作。该方法通过学习一种来重新排列点云中的点并加权输入特征。然后,将典型的卷积操作应用于转换后的特征。这种方法将传统的 CNN 扩展到点云特征学习,并命名为PointCNN。

u012901740的博客 2300

uva 10494 If We Were a Child Again(高精度与低精度求模和商)

If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!! I can guarante

不慌不忙、不急不躁 1486

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

UVA 10494 If We Were a Child Again 高精度除以低精度。。

If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!! I can guarante

Remilia's 850

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

UVA 10494 (暑假-高精度 -D - If We Were a Child Again)

#include #include #include int main() { char str_1[10001], op; long Max; while (scanf("%s %c%ld", str_1, &op, &Max) != EOF) { printf("%s %c %ld\n", str_1, op, Max); if (op == '/') print

Bingo 1848

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

(高精度运算4.7.27)UVA 10494 If We Were a Child Again(大数除法&&大数取余)

package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class UVA_10494 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); whi

黄俊东的专栏 1543

(高精度运算4.7.27)UVA 10494 If We Were a Child Again(大数除法&&大数取余)

package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class UVA_10494 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ...

weixin_34184561的博客 82

UVa 10494 - If We Were a Child Again

传送门 高精度水题

一只冰熊 1394

UVA 10494 If We Were a Child Again

UVA-10494题意:求给出的式子的结果。 解题思路:只有 / 和 % 2种运算。n保证小于2^31,高精除普通整数,记住余数和商,看题目要哪个就输出哪个。/************************************************************************* > File Name: UVA-10494.cpp > Author: N

QzNarsh的博客 296

UVaOJ 10494 - If We Were a Child Again

—— by A Code Rabbit Description 输入一个整除或求余的表达式,计算出结果。 注意:运算符两边有一个或多个空格。 Type Big Number Analysis 用 Java 的 BigInteger 轻松撸完。 也可以模拟竖式的计算来做。 虽然这里高精度除法的除数是单精度的, 但是懒得写了…… 本来想套模板,直接减法减到

A Code Rabbit 889

UVA - 10494 If We Were a Child Again

UVA - 10494 If We Were a Child Again题目大意:高精除法 求 整除 或者 余数 解题思路:由于除数不是高精的 所有每次进位取余 求商就好了/************************************************************************* > File Name: UVA-10494.cpp > A

cwb15505905513的博客 272

uva10494 - If We Were a Child Again

Problem C If We Were a Child Again Input: standard input Output: standard output Time Limit: 7 seconds   “Oooooooooooooooh! If I could do the easy mathematics like my school days!! I

uva code 1767

UVA - 10494 If We Were a Child Again

题目大意:高精度除法解题思路:循环记录余数和商,输出所求。余数在做被除数时需要 ×10 所以可能会大于 2^31,用 long long#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<ctype.h> using namespace std; char t

life kicks in right now 380

【uva】10494 If We Were a Child Again

开始刷uva了,之前的十来道题

废弃。。 538
上一篇: UVa 748 / POJ 1001 Exponentiation (浮点高精度求幂&正则表达式的应用)
下一篇: UVa 10420 List of Conquests (STL map)
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值