博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PAT L1-010. 比较大小
阅读量:4157 次
发布时间:2019-05-26

本文共 1229 字,大约阅读时间需要 4 分钟。

PAT L1-010. 比较大小


(1)

#include 
#include
using namespace std;intcmp(int a, int b) { return a < b;}intmain() { int a[3]; scanf("%d %d %d", &a[0], &a[1], &a[2]); sort(a, a + 3, cmp); printf("%d->%d->%d\n", a[0], a[1], a[2]); return 0;}

(2)

#include 
#include
using namespace std;intmain() { int a, b, c; scanf("%d %d %d", &a, &b, &c); if( a > b ) { swap(a, b); } if( a > c ) { swap(a, c); } if( b > c ) { swap(b, c); } printf("%d->%d->%d\n", a, b, c); return 0;}

(3)

#include 
intmain() { int a, b, c; scanf("%d %d %d", &a, &b, &c); if( a < b ) { if( b < c ) { printf("%d->%d->%d\n", a, b, c); } else { if( a < c ) { printf("%d->%d->%d\n", a, c, b); } else { printf("%d->%d->%d\n", c, a, b); } } } else { if( a < c ) { printf("%d->%d->%d\n", b, a, c); } else { if( b < c ) { printf("%d->%d->%d\n", b, c, a); } else { printf("%d->%d->%d\n", c, b, a); } } } return 0;}

转载地址:http://jpkxi.baihongyu.com/

你可能感兴趣的文章
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>
Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning
查看>>
Multiple Object Tracking with High Performance Detection and Appearance Feature
查看>>
深度学习入门(上)-第一章 必备基础知识点
查看>>
ubuntu unzip解压时提示错误 解决方法
查看>>
sprintf函数的说明
查看>>
BOOST_TYPEOF和BOOST_AUTO 作用
查看>>
随机森林概述
查看>>
2011十大战略技术
查看>>
大学应该学的软件知识
查看>>
腾讯与360战争背后的云计算阴影
查看>>
腾讯看了会沉默,360看了会流泪
查看>>