当前位置:网站首页>D22:indeterminate equation (indefinite equation, translation + problem solution)
D22:indeterminate equation (indefinite equation, translation + problem solution)
2022-07-06 01:34:00 【Aggressive Wenwen】
The original title is :OpenJudge - 22:Indeterminate Equation
translate :
describe : Given A,B and C. seek X and Y, send A ride X Add B ride Y be equal to C.
Input : Three not greater than 100 The positive integer A,B,C;
Output : Two integers X and Y.
Code : There is something wrong with this question .. Because there is only one set of samples , And there are other equal cases , such as 4*(-99)+7*58=10,4*(-8)+7*6=10 etc. , So it's better to output directly "-1 2"...
#include<iostream>
using namespace std;
int main()
{
int a,b,c,f=1;
int i,j;
cin>>a>>b>>c;
for(i=-5;i<101&&f;i++)
for(j=-5;j<101&&f;j++)
if(a*i+b*j==c){
cout<<i<<" "<<j<<endl;
f=0;
}
return 0;
}
边栏推荐
- Force buckle 9 palindromes
- leetcode刷题_反转字符串中的元音字母
- Alibaba canal usage details (pit draining version)_ MySQL and ES data synchronization
- 什么是弱引用?es6中有哪些弱引用数据类型?js中的弱引用是什么?
- Alibaba-Canal使用详解(排坑版)_MySQL与ES数据同步
- You are using pip version 21.1.1; however, version 22.0.3 is available. You should consider upgradin
- 02.Go语言开发环境配置
- Paddle framework: paddlenlp overview [propeller natural language processing development library]
- A Cooperative Approach to Particle Swarm Optimization
- Paddle框架:PaddleNLP概述【飞桨自然语言处理开发库】
猜你喜欢
Poj2315 football games
[detailed] several ways to quickly realize object mapping
一图看懂!为什么学校教了你Coding但还是不会的原因...
Redis-列表
伦敦银走势中的假突破
【Flask】官方教程(Tutorial)-part1:项目布局、应用程序设置、定义和访问数据库
Loop structure of program (for loop)
Mongodb problem set
Blue Bridge Cup embedded stm32g431 - the real topic and code of the eighth provincial competition
MATLB | real time opportunity constrained decision making and its application in power system
随机推荐
01.Go语言介绍
Recommended areas - ways to explore users' future interests
Tcpdump: monitor network traffic
leetcode刷题_平方数之和
Cookie concept, basic use, principle, details and Chinese transmission
3D模型格式汇总
【Flask】官方教程(Tutorial)-part3:blog蓝图、项目可安装化
MUX VLAN configuration
现货白银的一般操作方法
Paddle框架:PaddleNLP概述【飞桨自然语言处理开发库】
Initialize MySQL database when docker container starts
[flask] response, session and message flashing
Une image! Pourquoi l'école t'a - t - elle appris à coder, mais pourquoi pas...
About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)
Code Review关注点
Redis-列表
Paddle framework: paddlenlp overview [propeller natural language processing development library]
MATLB | real time opportunity constrained decision making and its application in power system
Netease smart enterprises enter the market against the trend, and there is a new possibility for game industrialization
VMware Tools installation error: unable to automatically install vsock driver