AtCoder Beginner Contest 001

Submission #1434953

Source codeソースコード

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

int main (void){
    
    int deg,dis,w,r;
    char dir[4]={'\0'};
    float tmp,mps;
    
    scanf("%d %d",&deg,&dis);
    
    tmp=(float)deg/10;
    if(tmp>=11.25&&tmp<33.75){strcat(dir,"NNE\0");}
    else if(tmp>=33.75&&tmp<56.25){strcat(dir,"NE\0");}
    else if(tmp>=56.25&&tmp<78.25){strcat(dir,"ENE\0");}
    else if(tmp>=78.25&&tmp<101.25){strcat(dir,"E\0");}
    else if(tmp>=101.25&&tmp<123.75){strcat(dir,"ESE\0");}
    else if(tmp>=123.75&&tmp<146.25){strcat(dir,"SE\0");}
    else if(tmp>=146.25&&tmp<168.75){strcat(dir,"SSE\0");}
    else if(tmp>=168.75&&tmp<191.25){strcat(dir,"S\0");}
    else if(tmp>=191.25&&tmp<213.75){strcat(dir,"SSW\0");}
    else if(tmp>=213.75&&tmp<236.25){strcat(dir,"SW\0");}
    else if(tmp>=236.25&&tmp<258.75){strcat(dir,"WSW\0");}
    else if(tmp>=258.75&&tmp<281.25){strcat(dir,"W\0");}
    else if(tmp>=281.25&&tmp<303.75){strcat(dir,"WNS\0");}
    else if(tmp>=303.75&&tmp<326.25){strcat(dir,"NW\0");}
    else if(tmp>=326.25&&tmp<348.75){strcat(dir,"NNW\0");}
    else {strcat(dir,"N\0");}
    
    mps=(float)(dis/60.0);
    mps*=10;
    mps+=0.5;
    r=mps;
    mps=r;
    mps/=10;
    
    if(mps>=0&&mps<=0.2){w=0;dir[0]='C';dir[1]='\0';}
    else if(mps>=0.3&&mps<=1.5){w=1;}
    else if(mps>=1.6&&mps<=3.3){w=2;}
    else if(mps>=3.4&&mps<=5.4){w=3;}
    else if(mps>=5.5&&mps<=7.9){w=4;}
    else if(mps>=8.0&&mps<=10.7){w=5;}
    else if(mps>=10.8&&mps<=13.8){w=6;}
    else if(mps>=13.9&&mps<=17.1){w=7;}
    else if(mps>=17.2&&mps<=20.7){w=8;}
    else if(mps>=20.8&&mps<=24.4){w=9;}
    else if(mps>=24.5&&mps<=28.4){w=10;}
    else if(mps>=28.5&&mps<=32.6){w=11;}
    else if(mps>=32.7){w=12;}
    
    printf("%s %d\n",dir,w);
    return 0;
}

Submission

Task問題 C - 風力観測
User nameユーザ名 siya
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1799 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&deg,&dis);
^

Test case

Set

Set name Score得点 / Max score Cases
all 0 / 100 00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,00_sample_05.txt,00_sample_06.txt,00_sample_07.txt,00_sample_08.txt,test_01.txt,test_02.txt,test_03.txt,test_04.txt,test_05.txt,test_06.txt,test_07.txt,test_08.txt,test_09.txt,test_10.txt,test_11.txt,test_12.txt,test_13.txt,test_14.txt,test_15.txt,test_16.txt,test_17.txt,test_18.txt,test_19.txt,test_20.txt,test_21.txt,test_22.txt,test_23.txt,test_24.txt,test_25.txt,test_26.txt,test_27.txt,test_28.txt,test_29.txt,test_30.txt,test_31.txt,test_32.txt,test_33.txt,test_34.txt,test_35.txt,test_36.txt,test_37.txt,test_38.txt,test_39.txt,test_40.txt,test_41.txt,test_42.txt,test_43.txt,test_44.txt,test_45.txt,test_46.txt,test_47.txt,test_48.txt,test_49.txt,test_50.txt,test_51.txt,test_52.txt,test_53.txt,test_54.txt,test_55.txt,test_56.txt,test_57.txt,test_58.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 1 ms 128 KB
00_sample_02.txt AC 1 ms 128 KB
00_sample_03.txt AC 1 ms 128 KB
00_sample_04.txt AC 1 ms 128 KB
00_sample_05.txt AC 1 ms 128 KB
00_sample_06.txt AC 1 ms 128 KB
00_sample_07.txt AC 1 ms 128 KB
00_sample_08.txt AC 1 ms 128 KB
test_01.txt AC 1 ms 128 KB
test_02.txt AC 1 ms 128 KB
test_03.txt AC 1 ms 128 KB
test_04.txt AC
test_05.txt AC 1 ms 128 KB
test_06.txt WA
test_07.txt WA
test_08.txt AC
test_09.txt WA
test_10.txt AC
test_11.txt AC
test_12.txt AC
test_13.txt WA
test_14.txt AC 1 ms 128 KB
test_15.txt AC 1 ms 128 KB
test_16.txt AC 1 ms 128 KB
test_17.txt AC 1 ms 128 KB
test_18.txt AC 1 ms 128 KB
test_19.txt AC 1 ms 128 KB
test_20.txt AC
test_21.txt AC
test_22.txt AC
test_23.txt AC 1 ms 128 KB
test_24.txt AC 1 ms 128 KB
test_25.txt AC 1 ms 128 KB
test_26.txt AC 1 ms 128 KB
test_27.txt AC 1 ms 128 KB
test_28.txt AC 1 ms 128 KB
test_29.txt AC 1 ms 128 KB
test_30.txt WA
test_31.txt AC
test_32.txt AC 1 ms 128 KB
test_33.txt AC
test_34.txt AC
test_35.txt AC
test_36.txt AC
test_37.txt AC
test_38.txt AC 1 ms 128 KB
test_39.txt AC 1 ms 128 KB
test_40.txt WA
test_41.txt AC 1 ms 128 KB
test_42.txt AC 1 ms 128 KB
test_43.txt AC 1 ms 128 KB
test_44.txt AC
test_45.txt AC
test_46.txt AC
test_47.txt AC 1 ms 128 KB
test_48.txt AC 1 ms 128 KB
test_49.txt AC
test_50.txt AC 1 ms 128 KB
test_51.txt AC 1 ms 128 KB
test_52.txt AC 1 ms 128 KB
test_53.txt AC 1 ms 128 KB
test_54.txt AC
test_55.txt WA
test_56.txt AC
test_57.txt AC 1 ms 128 KB
test_58.txt AC 1 ms 128 KB