数学概念——I - 数论,线性方程
Description
The Birds is Fly in the Sky.
The Wind is Wonderful.
Blew Throw the Trees
Trees are Shaking, Leaves are Falling.
Lovers Walk passing, and so are You.
................................Write in English class by yifenfei
Girls are clever and bright. In HDU every girl like math. Every girl like to solve math problem! 
Now tell you two nonnegative integer a and b. Find the nonnegative integer X and integer Y to satisfy X*a + Y*b = 1. If no such answer print "sorry" instead. 
Input
Each case two nonnegative integer a,b (0<a, b<=2^31)
Output
Sample Input
Sample Output
#include <cstdio>
using namespace std;
int x,y;
int gcd(int a,int b)
{
if(b==)
{
x=;
y=;
return a;
}
else
{
int d=gcd(b,a%b);
int r=x;
x=y;
y=r-(a/b)*y;
return d;
}
}
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)==)
{
int d=gcd(a,b);
if(d!=)
printf("sorry\n");
else
{
while(x<=)
{
x=x+b;
y=y-a;
}
printf("%d %d\n",x,y);
}
}
return ;
}
数学概念——I - 数论,线性方程的更多相关文章
- 数学概念——J - 数论,质因数分解
		
J - 数论,质因数分解 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit ...
 - 21副GIF动图让你了解各种数学概念
		
baidu 21副GIF动图让你了解各种数学概念
 - 转:21副GIF动图让你了解各种数学概念
		
21副GIF动图让你了解各种数学概念
 - Math concepts / 数学概念
		
链接网址:Math concepts / 数学概念 – https://www.codelast.com/math-concepts-%e6%95%b0%e5%ad%a6%e6%a6%82%e5%bf ...
 - 集训第六周 数学概念与方法 数论 线性方程 I题
		
Description The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Tr ...
 - 集训第六周 数学概念与方法  J题 数论,质因数分解
		
Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all g ...
 - 集训第六周 数学概念与方法 数论 筛素数 H题
		
Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识. 问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“ ...
 - 集训第六周 数学概念与方法 概率 数论 最大公约数 G题
		
Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must h ...
 - 数学概念——F  概率(经典问题)birthday paradox
		
F - 概率(经典问题) Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit S ...
 
随机推荐
- 处理移动端click事件300ms延迟的好方法—FastClick
			
下载地址:https://github.com/ftlabs/fastclick 1.click事件为什么有延迟? “...mobile browsers will wait approximatel ...
 - 快速打出System.out.println("");
			
sysout---->Alt+/--->System.out.println():
 - order by
 - Erlang - Download and Install for Linux
			
1. 下载 Erlang [huey@huey-K42JE erlang]$ wget http://www.erlang.org/download/otp_src_R16B03.tar.gz 2. ...
 - asp.net手动填充TreeView生成树
			
最近在做项目发现需要用到树的地方,页面的前台任然是使用一个asp.net的控件TreeView来显示树的结构,当然也可以自己在前台写一个树来展示,这在后期跟局功能的不同很大可能会要用到异步的知识,废话 ...
 - java String对象的创建(jvm).
			
本人目前也开始学习虚拟机,在java中,有很多种类型的虚拟机,其中就以sum公司(当然现在已经是oracle了)的虚拟机为例,介绍可能在面试的时候用到的,同时对自己了解String有很大帮助,这里仅仅 ...
 - 如何清除xcode里面的mobileprovision文件
			
通过终端进行删除 首先cd到目录”~/Library/MobileDevice/Provisioning\ Profiles” cd ~/Library/MobileDevice/Provisioni ...
 - linux负载均衡
			
1.linux lvs nat实现负载均衡 添加两块网卡并开启路由管道 > /proc/sys/net/ipv4/ip_forward //开始路由管道 安装ipvsadm yum instal ...
 - java获取数据库数据表的元数据
			
Connction conn; DatabaseMetaData dmd=conn.getMetaData();//获取数据库元数据 PreparedStatment ps; ps.getParame ...
 - yum安装ftp服务器
			
1.安装vsftp,本文采用yum安装: #yum install vsftpd 2.安装后运行: # service vsftpd restart Shutting downvsftpd: ...