- 三位数重新排列
答案
- 2025-3-30 20:02:11 @
三位数重新排列
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c;
cin>>n;
a=n%10;
b=n/10%10;
c=n/100;
if(a>b) swap(a,b);
if(a>c) swap(a,c);
if(b>c) swap(b,c);
cout<<a*100+b*10+c;
return 0;
}
1 comments
-
张景 LV 8 @ 2025-3-30 20:03:32
千钱买千鸡
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; for(int i=0;i<=1000/a;i++) { for(int j=0;j<=1000/b;j++) { for(int k=0;k<=1000/c;k++) { int l=1000-i-k-j; if(l+i+j+k==1000&&i*a+j*b+k*c+l*1.0/d==1000){ cout<<i<<' '<<j<<' '<<k<<' '<<l; return 0; } } } } cout<<"-i"; return 0; }
- 1
Information
- ID
- 2593
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- # Submissions
- 42
- Accepted
- 14
- Uploaded By