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 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算