【ZhengQing】[1743]Solve the Equation

Problem Description

Loading...

Problem Analysis

I wrote this code earlier
First, the output had no newline
Second, I didn’t pay attention to the data range

I was still young back then~
Looking through old problems, I’ll use this one as a memento.

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include<stdio.h>
int main() {
	long long a=0,b=0,x1,x2,y1,y2,q,w;
	while(scanf("%lld %lld %lld %lld %lld %lld",&x1,&y1,&x2,&y2,&q,&w),
	        x1!=0||x2!=0||y1!=0||y2!=0||q!=0||w!=0) {
		a=(q*y2-x2*w)/(x1*y2-x2*y1);
		b=(q*y1-x1*w)/(x2*y1-x1*y2);
		printf("%lld %lld\n",a,b);
	}
	return 0;
}

ZZULI 1743 Solve Equation

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...