入门手把手教学代码

HDU2000:

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    char a,b,c;
    while(cin>>a>>b>>c){
       if(a>b) swap(a,b);
       if(b>c) swap(b,c);
       if(a>b) swap(a,b);
       cout<<a<<" "<<b<<" "<<c<<endl; 
    }
    return 0;
}

HDU1001:

 #include<bits/stdc++.h>
using namespace std;
int main()
{ 
    long long ans,n;
    while(cin>>n)
    {
        ans=(1+n)*n/2;
        cout<<ans<<endl;
        cout<<endl;
    }
    return 0;
}

HDU2003:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double N;
    while(cin>>N)
    {
        if(N>0) printf("%.2lf\n",N);
        else printf("%.2lf\n",-N);
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/hua-dong/p/9837027.html