2015 Syrian Private Universities Collegiate Programming Contest(gym101020)

来源:互联网 发布:3dsmax2014软件许可证 编辑:程序博客网 时间:2024/05/01 18:15

Problem A. Window

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define eps 1e-8typedef long long LL;const double pi = acos(-1.0);const int mod = 1e9 + 7;using namespace std;int main(){    //freopen("int.txt","r",stdin);    //freopen("out.txt","w",stdout);    LL n,m;    int T;    cin >> T;    while(T--){        cin >> n >> m;        cout << n * m << endl;    }    return 0;}

Problem B. Paper Game

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define eps 1e-8typedef long long LL;const double pi = acos(-1.0);const int mod = 1e9 + 7;using namespace std;int main(){    //freopen("int.txt","r",stdin);    //freopen("out.txt","w",stdout);    int n,m;    int T;    cin >> T;    while(T--){        cin >> n >> m;        if(n % 2 == 1 && m % 2 == 1)            puts("Hussain");        else             puts("Hasan");    }    return 0;}

Problem C. Rectangles

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define eps 1e-8typedef long long LL;const double pi = acos(-1.0);const int mod = 1e9 + 7;using namespace std;int a[105];int main(){    //freopen("int.txt","r",stdin);    //freopen("out.txt","w",stdout);    int T,n,i,j,k;    cin >> T;    while(T--){        memset(a,0,sizeof(a));        cin >> n;        for(int p = 1;p <= n;p++){            cin >> i >> j >> k;            for(int l = i + 1;l <= j;l++)                a[l] = max(a[l],k);        }        int ans = 0;        for(int h = 1;h <= 100;h++)            ans += a[h];        cout << ans << endl;    }    return 0;}

Problem D. Sequences
题意:给你一个数组,让你找出这个数组中最长的一个序列,这个序列要求满足严格递增,且后一个数比前一个数大1

Problem E. Napol´eon
没太懂题意

Problem F. The Best Strategy

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define eps 1e-8typedef long long LL;const double pi = acos(-1.0);const int mod = 1e9 + 7;using namespace std;int a[105];int sum[105];int main(){    //freopen("int.txt","r",stdin);    //freopen("out.txt","w",stdout);    int T,n;    cin >> T;    int cnt = 0;    while(T--){        cin >> n;        memset(sum,0,sizeof(sum));        for(int i = 1;i <= n;i++)            cin >> a[i];        sort(a + 1,a + n + 1);        int time = 0;        int solve = 0;        for(int i = 1;i <= n;i++)        {            sum[i] = a[i] + sum[i - 1];            if(sum[i] <= 300){                time += sum[i];                solve++;            }            else                break;        }        printf("Case %d: %d %d\n",++cnt,solve,time);    }    return 0;}

Problem J. Good Coins

#include <bits/stdc++.h>#define INF 0x3f3f3f3f#define eps 1e-8typedef long long LL;const double pi = acos(-1.0);const int mod = 1e9 + 7;using namespace std;int gcd(int a,int b){    return !b ? a : gcd(b,a % b);}int main(){    //freopen("int.txt","r",stdin);    //freopen("out.txt","w",stdout);    int T,i,j;    cin >> T;    while(T--){        cin >> i >> j;        if(gcd(i,j) == 1)            puts("GOOD");        else            puts("NOT GOOD");    }    return 0;}
0 0
原创粉丝点击