weixin_45337755 2019-09-11 16:46 采纳率: 0%
浏览 648

杭电oj 2629题目求解惑

杭电oj2629
自己编译运行输出是符合要求的,可是再oj上就是提示输出错误,希望好心人能为我解惑!!!

#include<stdio.h>
#include<string.h>

int main() {
    int n;
    char s[20];

    int place,birthday,garbage;
    int year, month, day;
    scanf("%d", &n);
    while (n--)
    {
        scanf("%6d", &place);
        scanf("%8d", &birthday);
        scanf("%4d", &garbage);

        if (place == 330000)
            strcpy(s,"Zhejiang");
        else if (place == 110000)
            strcpy(s, "Beijing");
        else if (place == 710000)
            strcpy(s, "Taiwan");
        else if (place == 810000)
            strcpy(s, "Hong Kong");
        else if (place == 820000)
            strcpy(s, "Macao");
        else if (place == 540000)
            strcpy(s, "Tibet");
        else if (place == 210000)
            strcpy(s, "Liaoning");
        else if (place == 310000)
            strcpy(s, "Shanghai");

        year = birthday / 10000;
        month = birthday / 100 - year * 100;
        day = birthday % 100;

        printf("He/She is from %s,and his/her birthday is on %d,%d,%d based on the table.\n", s, month, day, year);

    }

    return 0;
}
  • 写回答

1条回答

  • wowpH 2019-09-11 20:13
    关注

    Here is Samuel's ID number 331004198910120036 can you tell where he is from?The first 2 numbers tell that he is from Zhengjiang Province,number 19891012 is his birthday date (yy/mm/dd).

    把这句话好好看看。

    评论

报告相同问题?

悬赏问题

  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问