/ 科创班 /

记录详情

Accepted

/in/foo.cc: In function 'int main()':
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     };
     ^
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:11:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:14:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     };
     ^
/in/foo.cc:14:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:14:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:14:5: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
/in/foo.cc:15:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     char* oclick = "o'clock";
                    ^~~~~~~~~
# 状态 耗时 内存占用
#1 Accepted 3ms 256.0 KiB
#2 Accepted 2ms 364.0 KiB
#3 Accepted 4ms 256.0 KiB
#4 Accepted 3ms 364.0 KiB
#5 Accepted 3ms 364.0 KiB
#6 Accepted 2ms 256.0 KiB
#7 Accepted 2ms 376.0 KiB
#8 Accepted 3ms 352.0 KiB
#9 Accepted 1ms 344.0 KiB

代码

#include <stdio.h>

int main()
{
    int h, m;
    char* en0to19[] = {
        "zero","one","two","three","four","five",
        "six","seven","eight","nine","ten","eleven",
        "twelve","thirteen","fourteen","fifteen",
        "sixteen","seventeen","eighteen","nineteen"
    };
    char* en20to50[] = {
        "twenty","thirty","forty","fifty"
    };
    char* oclick = "o'clock";
    scanf("%d%d", &h, &m);
    if (h >= 20)
    {
        printf("%s", en20to50[0]);
        if (h % 20 > 0)
            printf(" %s", en0to19[h % 20]);
    }
    else
    {
        printf("%s", en0to19[h]);
    }
    if (m == 0)
    {
        printf(" %s", oclick);
    }
    else if (m >= 20)
    {
        printf(" %s", en20to50[m / 10 - 2]);
        if (m % 10 > 0)
            printf(" %s", en0to19[m % 10]);
    }
    else
    {
        printf(" %s", en0to19[m]);
    }
    return 0;
}

信息

递交者
类型
递交
题目
报时助手
题目数据
下载
语言
C++
递交时间
2018-10-17 21:47:18
评测时间
2018-10-17 21:47:18
评测机
分数
100
总耗时
27ms
峰值内存
376.0 KiB