include <iostream>

2016-6-2 10:22
请先登录。

创建了 #2016级面向对象程序设计(C++)# 任务:

参考答案任务10_1 矩阵的运算
#include #include using namespace std; const int INIT_STACK_SIZE = 20; const int STACKINCREMENT = 10; c...

创建了 #2016级面向对象程序设计(C++)# 任务:

参考答案 任务09_3 一道算术题

答案仅供参考,并不唯一,只需实现题目要求功能即可。 #include #include using namespace std; // 给定的输入及输出"格式字符" string image[7] =...

#include <iostream> #include <cstdlib> #include <malloc.h> using namespace std; const int M=5; const int N=3; typed...
/* 年级:2014级  班级:7班  姓名:袁音  学号:2014011870 */ #include <iostream> #define Space 110 #define Os 10 typedef struct Fr...
/** *任务名称:作业调度的模拟 *姓名:孟一凡 *班级:3班 *学号:2014011657 **/ #include <iostream> #include <cstdlib> #include <malloc.h> using na...
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <climits>
using namespace std;

#define LS 2*i
#define RS 2*i+1
#define UP(i,x,y) for(i=x;i<=y;i++)
#define DOWN(i,x,y) for(i=x;i>=y;i--)
#define MEM(a,x) memset(a,x,sizeof(a))
#define W(a) while(a)
#define LL long long
#define N 25
#define MOD 19999997
#define INF 0x3f3f3f3f
#define EXP 1e-8

int t,hour,a,b,r,cas=1,m,s;
double minute,second;
char str[10];

void setA()
{
    if(r<=0)
        r+=360;
    minute = r/5.5;
    W(minute>=60)
    {
        hour++;
        minute-=60;
    }
    if(hour>12)
        hour-=12;
    m = (int)minute;
}

void setT()
{
    if(r>=0) r-=360;
    minute=r/5.5;
    hour--;
    W(minute<=-60)
    {
        hour--;
        minute+=60;
    }
    if(hour<=0)
        hour+=12;
    if(fabs(minute)<=EXP)
    {
        hour++;
        if(hour>12)
            hour-=12;
    }
    else minute+=60;
    m = (int)minute;
}

int main()
{
    scanf("%d",&t);
    W(t--)
    {
        scanf("%d%s%d",&a,str,&hour);
        b = 30*(12-hour);
        r = a-b;
        if(str[0]=='a')
            setA();
        else
            setT();
        second = (minute-(int)minute)*60;
        s = (int)(second+0.5);
        printf("Case %d: %d:%02d:%02d\n",cas++,hour,m,s);
    }


    return 0;
}
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <climits>
using namespace std;

#define LS 2*i
#define RS 2*i+1
#define UP(i,x,y) for(i=x;i<=y;i++)
#define DOWN(i,x,y) for(i=x;i>=y;i--)
#define MEM(a,x) memset(a,x,sizeof(a))
#define W(a) while(a)
#define LL long long
#define N 25
#define MOD 19999997
#define INF 0x3f3f3f3f
#define EXP 1e-8

int t,hour,a,b,r,cas=1,m,s;
double minute,second;
char str[10];

void setA()
{
    if(r<=0)
        r+=360;
    minute = r/5.5;
    W(minute>=60)
    {
        hour++;
        minute-=60;
    }
    if(hour>12)
        hour-=12;
    m = (int)minute;
}

void setT()
{
    if(r>=0) r-=360;
    minute=r/5.5;
    hour--;
    W(minute<=-60)
    {
        hour--;
        minute+=60;
    }
    if(hour<=0)
        hour+=12;
    if(fabs(minute)<=EXP)
    {
        hour++;
        if(hour>12)
            hour-=12;
    }
    else minute+=60;
    m = (int)minute;
}

int main()
{
    scanf("%d",&t);
    W(t--)
    {
        scanf("%d%s%d",&a,str,&hour);
        b = 30*(12-hour);
        r = a-b;
        if(str[0]=='a')
            setA();
        else
            setT();
        second = (minute-(int)minute)*60;
        s = (int)(second+0.5);
        printf("Case %d: %d:%02d:%02d\n",cas++,hour,m,s);
    }


    return 0;
}