1. 程式人生 > >HDU基本的輸入輸出格式題目1089-1096

HDU基本的輸入輸出格式題目1089-1096

HDU1089

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int a,b;
    while(cin>>a>>b)
    {
        cout<<a+b<<endl;
    }
    return 0;
}

HDU1090

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    return 0;
}

HDU1091

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a==0&&b==0)
            break;
        cout<<a+b<<endl;
    }
    return 0;
}

HDU1092

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int n;
    while(cin>>n&&n)
    {
        int sum = 0;
        int x;
        for(int i = 0; i < n; i++)
        {
            cin>>x;
            sum += x;
        }
        cout<<sum<<endl;
    }
    return 0;
}

HDU1093

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int sum = 0;
        int x;
        while(n--)
        {
            cin>>x;
            sum += x;
        }
        cout<<sum<<endl;
    }
    return 0;
}

HDU1094

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int n;
    while(cin>>n&&n)
    {
        int sum = 0;
        int x;
        for(int i = 0; i < n; i++)
        {
            cin>>x;
            sum += x;
        }
        cout<<sum<<endl;
    }
    return 0;
}

HDU1095

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int a,b;
    while(cin>>a>>b)
    {
        cout<<a+b<<endl<<endl;
    }
    return 0;
}

HDU1096

#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int sum = 0;
        while(n--)
        {
            int x;
            cin>>x;
            sum += x;
        }
        cout<<sum<<endl;
        if(t)
            cout<<endl;
    }
    return 0;
}