Ultraviolet A 12714 two points Revisited (simple mathematical problem)

Source: Internet
Author: User

Reprinted please indicate the source: http://blog.csdn.net/u012860063

Question link: http://uva.onlinejudge.org/index.php? Option = com_onlinejudge & Itemid = 8 & page = show_problem & problem = 4452


Question: two points are given to form a straight line. If you want to output any two points, the two points must form a straight line and the given straight line is vertical (note that the output points cannot have negative numbers );


The Code is as follows:

# Include <cstdio> int main () {int N, x1, x2, Y1, Y2; int CAS = 0; while (~ Scanf ("% d", & N) {While (n --) {scanf ("% d", & X1, & Y1, & X2, & Y2); printf ("case % d:", ++ CAS); If (x1 = x2) {printf ("0 0 1 0 \ n "); continue;} If (Y1 = Y2) {printf ("0 0 0 1 \ n"); continue;} If (x1-x2> 0 & y1-y2> 0) {printf ("% d 0 0% d \ n", y1-y2, x1-x2);} else if (x1-x2> 0 & y1-y2 <0) {printf ("0 0% d % d \ n", y2-y1, x1-x2);} else if (x1-x2 <0 & y1-y2> 0) {printf ("0 0% d % d \ n", y1-y2, x2-x1);} else if (x1-x2 <0 & y1-y2 <0) {printf ("% d 0 0% d \ n", y2-y1, x2-x1) ;}} return 0 ;}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.