码迷,mamicode.com
首页 > 其他好文 > 详细

E - Helping the HR Gym - 102040E

时间:2019-11-29 10:41:44      阅读:68      评论:0      收藏:0      [点我收藏+]

标签:break   less   hid   image   typedef   ide   ==   pair   技术   

技术图片

一个计算迟到早退违纪扣分的东西

题意简单明了

情况有点多,分各种情况讨论,有点麻烦但是难度不大

 

一次性写的所以代码很乱,就当留给自己看吧

上代码:

技术图片
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
//#define sort(a,n,int) sort(a,a+n,less<int>())

#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db;

const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;

bool compare(int a, int b)
{
    return a < b;//升序
}

int main()
{
    int n = 0;
    char a[20];
    int a1[6];
    char s;
    while(1)
    {
        cin >>n;
        if(n == 0)break;
        int points = 0;
        while(n--)
        {
            cin >>a;
            s = a[0];
            int pool = 0;
            int counter = 0;
            for(int i = 2;i<20;i++)
            {
                 if(a[i]==: || a[i]==\0)
                {
                     a1[counter] = pool;
                    counter++;
                    pool = 0;
                }
                else
                {
                       pool = pool*10 +a[i]-48;
                }
             }
             /*
            cout <<s<<endl;////
            for(int i = 0;i<6;i++)////
            {
                 cout<<a1[i]<<endl;
            }
            */
            if(s == D)
            {
                if(a1[0] < 9)
                {
                    if(a1[3]-a1[0] > 8)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!11"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!11"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!11"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!1"<<endl;
                    }
                }
                else if(a1[0]==9 && a1[1]<30)
                {
                    if(a1[3]-a1[0] > 8)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!21"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!21"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!21"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!2"<<endl;
                    }
                 }
                 else if(a1[0]==9 && a1[1]==30 && a1[2]==0)
                 {
                     if(a1[3]-a1[0] > 8)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!31"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!31"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 8 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 8);
                        else if(a1[3]-8 == 8 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 8 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!31"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!3"<<endl;
                    }
                 }
                 else
                 {
                     points++;
                     //cout<<"!8"<<endl;
                 }
            }
            else if(s == E)
            {
                if(a1[0] < 12)
                {
                    if(a1[3]-a1[0] > 9)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!41"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!41"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!41"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!4"<<endl;
                    }
                }
                else if(a1[0]==12 && a1[1]<30)
                {
                    if(a1[3]-a1[0] > 9)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!51"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!51"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!51"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!5"<<endl;
                    }
                 } 
                 else if(a1[0]==12 && a1[1]==30 && a1[2]==0)
                 {
                     if(a1[3]-a1[0] > 9)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!61"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] > 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!61"<<endl;
                        }
                    }
                    else if(a1[3]-a1[0] == 9 && a1[4]-a1[1] == 0 && a1[5]-a1[2] >= 0)
                    {
                        if(a1[3]-8 > 9);
                        else if(a1[3]-8 == 9 && a1[4]-30 > 0);
                        else if(a1[3]-8 == 9 && a1[4]-30 == 0 && a1[5] >= 0);
                        else 
                        {
                             points++;
                            //cout<<"!61"<<endl;
                        }
                    }
                    else 
                    {
                         points++;
                         //cout<<"!6"<<endl;
                    }
                 }
                 else
                 {
                    points++;
                     //cout<<"!7"<<endl;
                }
            }
        }
        if(points == 0)
        {
            cout<<"All OK"<<endl;
        }
        else if(points > 3)
        {
              cout<<"Issue Show Cause Letter"<<endl;
        }
        else
        {
            cout <<points <<" Point(s) Deducted"<<endl;
        }
    }
    return 0;
} 
View Code

 

E - Helping the HR Gym - 102040E

标签:break   less   hid   image   typedef   ide   ==   pair   技术   

原文地址:https://www.cnblogs.com/SutsuharaYuki/p/11948906.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!