点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 其他页面 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

From sina007
工作安排
讨论 Discussion
 
123454321
#include<iostream>
using namespace std;
int main(){
    freopen("p1614.in","r",stdin);
    freopen("p1614.out","w",stdout);
int n,i,j,k,t,a[100]={0};
cin>>n;
i=0;
while(n>0){
i++;
a[i]=n%10;
n=n/10;
}
k=i;
for(i=1;i<=k-1;i++){
for(j=i+1;j<=k;j++)
{
if(a[j]>a[i]){
t=a[j];a[j]=a[i];a[i]=t;
}
}
}
for(i=1;i<=k;i++)cout<<a[i];
     fclose(stdin);
     fclose(stdout);
return 0;


}
( )

123
#include<bits/stdc++.h>
using namespace std;
int main()
{
// freopen("p1614.in","r",stdin);
// freopen("p1614.out","w",stdout);
int n,a,b,c;
cin>>n;
a=n/100;
b=n%100/10;
c=n%100%10/1;
if(a>b&&b>>c)
cout<<a<<b<<c;
else
if(a>b&&a>c&&c>b)
cout<<a<<c<<b;
else
if(b>a&&a>c)
cout<<b<<a<<c;
else
if(b>a&&b>c&&c>a)
cout<<b<<c<<a;
else
if(c>a&&a>b)
cout<<c<<a<<b;
else
if(c>a&&c>b&&b>a)
cout<<c<<b<<a;
// fclose(stdin);
// fclose(stdout);
return 0;
}
( )
发布讨论主题 回复讨论主题
Flag
  
题号
  P1578
  其它
通过
  2人
提交
  7次
通过率
  29%
难度
  2
提交 讨论 题解
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1390 | Online Users / Processes : 0 / 279 | Processed Time : 383 ms | Server Time : 2026/9/10 12:43:29