当前位置:网站首页>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;
}
边栏推荐
- About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)
- Unity | two ways to realize facial drive
- Threedposetracker project resolution
- [Yu Yue education] Liaoning Vocational College of Architecture Web server application development reference
- 【网络攻防实训习题】
- MATLB | real time opportunity constrained decision making and its application in power system
- Unity | 实现面部驱动的两种方式
- 剑指 Offer 12. 矩阵中的路径
- ORA-00030
- [the most complete in the whole network] |mysql explain full interpretation
猜你喜欢
c#网页打开winform exe
Electrical data | IEEE118 (including wind and solar energy)
Test de vulnérabilité de téléchargement de fichiers basé sur dvwa
Basic operations of database and table ----- set the fields of the table to be automatically added
Kotlin basics 1
Leetcode skimming questions_ Invert vowels in a string
500 lines of code to understand the principle of mecached cache client driver
【已解决】如何生成漂亮的静态文档说明页
电气数据|IEEE118(含风能太阳能)
Yii console method call, Yii console scheduled task
随机推荐
Redis守护进程无法停止解决方案
国家级非遗传承人高清旺《四大美人》皮影数字藏品惊艳亮相!
Redis-Key的操作
剑指 Offer 38. 字符串的排列
Leetcode skimming questions_ Sum of squares
Test de vulnérabilité de téléchargement de fichiers basé sur dvwa
ORA-00030
ClickOnce 不支持请求执行级别“requireAdministrator”
干货!通过软硬件协同设计加速稀疏神经网络
网易智企逆势进场,游戏工业化有了新可能
File upload vulnerability test based on DVWA
WGet: command line download tool
PHP error what is an error?
UE4 unreal engine, editor basic application, usage skills (IV)
Folio. Ink is a free, fast and easy-to-use image sharing tool
Basic operations of databases and tables ----- primary key constraints
竞赛题 2022-6-26
Remember that a version of @nestjs/typeorm^8.1.4 cannot be obtained Env option problem
Electrical data | IEEE118 (including wind and solar energy)
Unreal browser plug-in