AtCoder Grand Contest 008

Submission #1358123

Source codeソースコード

#include <bits/stdc++.h>


int main() {
    FILE * fi, * fout;
    int x, y;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d%d" ,&x,&y);
    if(x < y) {
       if(std::abs(x) <= y)
          fprintf(fout,"%d" ,y - std::abs(x) + (x < 0));
       else
          fprintf(fout,"%d" ,y - x);
    }
    else {
       if(std::abs(x) >= std::abs(y))
          fprintf(fout,"%d" ,1 + y + x);
       else {
          int flag = 0;
          if(x < 0)
            flag++;
          fprintf(fout,"%d" ,std::abs(y) - std::abs(x) + 1 + flag);
       }
    }
    fprintf(fout,"\n");
    //fclose(fi);
   // fclose(fout);
    return 0;
}

Submission

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

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

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:29: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fi,"%d%d" ,&x,&y);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 0 / 300 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
0_02.txt AC 1 ms 256 KB
1_00.txt AC 1 ms 256 KB
1_01.txt AC 1 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt AC 1 ms 256 KB
1_05.txt WA
1_06.txt AC 1 ms 256 KB
1_07.txt AC 1 ms 256 KB
1_08.txt AC 1 ms 256 KB
1_09.txt WA
1_10.txt AC 1 ms 256 KB