3097:练17.3 比大小
练 17.3 比大小
第19课 比大小 《小学生C++趣味编程》
信息学奥赛一本通-编程启蒙3097:练17.3 比大小
C语言代码:
/*
试编一个程序,输入两个整数,
比较大小,并按由小到大的顺序输出。
*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
//temporary 暂时的
int a,b,tmp;
//cout<<"a,b=";
scanf("%d%d",&a,&b);
if( a>b)
{
tmp=a;
a=b;//a=10
b=tmp;//b=20
}
printf("%d %d\n",a,b);
return 0;
}
C++代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<min(a,b)<<" "<<max(a,b);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
if(a>b) cout<<b<<" "<<a;
else cout<<a<<" "<<b;
return 0;
}
python3代码:
a,b=input().split()
a=int(a)
b=int(b)
if b<a:
print("%d %d"%(b,a) )
else:
print("%d %d"%(a,b) )
【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解
【用脚趾头解决NOIP】(1):NOIP2010~NOIP2015普及组问题求解_把m个同样的球放到n个同样的袋子里,允许有的袋子空着不放,问共有多少种不同的放置-CSDN博客
【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序
【用脚趾头解决NOIP】(2)NOIP2009~NOIP2015年普及组完善程序_最大连续子段和 noip 2009-CSDN博客
C++信息学奥赛题目归类:初赛普及组阅读程序写结果题
C++信息学奥赛题目归类:初赛普及组阅读程序写结果题_#include <iostream> using namespace std; int n, m;-CSDN博客
FBZ串问题 NOIP1998
NOIP2017初赛_提高组_阅读程序写结果3.2
NOIP初赛_阅读与理解程序
C++基础 二维数组之蛇形矩阵、蛇形填数、神奇的幻方等