入门菜鸟

熟悉语言的题目

http://wikioi.com/problem/1201/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
int main()
{
    int n ;
    while(~scanf("%d",&n))
    {
        int minn=(1LL<<31)-1,maxn=-1 ;
        for(int i=0 ;i<n ;i++)
        {
            int a ;
            scanf("%d",&a) ;
            minn=min(minn,a) ;
            maxn=max(maxn,a) ;
        }
        printf("%d %d
",minn,maxn) ;
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/1202/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
int main()
{
    int n ;
    while(~scanf("%d",&n))
    {
        int sum=0 ;
        for(int i=0 ;i<n ;i++)
        {
            int a ;
            scanf("%d",&a) ;
            sum+=a ;
        }
        printf("%d
",sum) ;
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/1203/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
const double esp=1e-7 ;
int main()
{
    double a,b ;
    while(~scanf("%lf%lf",&a,&b))
    {
        if(a-b<esp && a-b>-esp)
            puts("yes") ;
        else puts("no") ;
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/1206/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
const double esp=1e-7 ;
int main()
{
    double a ;
    while(~scanf("%lf",&a))
    {
        printf("%.2lf
",a) ;
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/2235/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
const double esp=1e-7 ;
int main()
{
    double a,b ;
    while(~scanf("%lf%lf",&a,&b))
    {
        int ans=((int)(a*(b/10)/10+0.5))*10 ;
        printf("%d
",ans) ;
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/1204/

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
const double esp=1e-7 ;
char a[1005],b[1005] ;
int main()
{
    while(~scanf("%s%s",a,b))
    {
        int lena=strlen(a) ;
        int lenb=strlen(b) ;
        for(int i=0 ;i<lena ;i++)
        {
            int flag=1 ;
            for(int j=i ;j<i+lenb ;j++)
                if(a[j]!=b[j-i])
                {
                    flag=0 ;
                    break ;
                }
            if(flag)
            {
                printf("%d
",i+1) ;
                break ;
            }
        }
    }
    return 0 ;
}
View Code

http://wikioi.com/problem/1205/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std ;
const double esp=1e-7 ;
string a ;
int main()
{
    int first=1 ;
    stack <string> S ;
    while(cin >> a)
    {
        S.push(a) ;
    }
    while(!S.empty())
        if(first)
        {
            first=0 ;
            cout << S.top() ;
            S.pop() ;
        }
        else
        {
            cout << " " << S.top() ;
            S.pop() ;
        }
    cout << endl ;
    return 0 ;
}
View Code
原文地址:https://www.cnblogs.com/xiaohongmao/p/3768698.html