Submission #432656
Source Code Expand
#include <stdio.h> #pragma warning(disable: 4996) #include <vector> #include <string> #include <iostream> #include <math.h> int main(void){ int n, a, b; std::string s; int d; int at = 0;//east+ int move; scanf("%d %d %d", &n, &a, &b); for(int i = 0;i < n;i++){ std::cin >> s; std::cin >> d; if(d < a) move = a; else if(d > b) move = b; else move = d; if(s == "East"){ at += move; }else if(s == "West"){ at -= move; } } if(at > 0) printf("East "); else if(at < 0) printf("West "); printf("%d\n", abs(at)); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 双子とスイカ割り |
User | shizave |
Language | C++ (GCC 4.9.2) |
Score | 0 |
Code Size | 587 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:31:23: error: ‘abs’ was not declared in this scope printf("%d\n", abs(at)); ^ ./Main.cpp:15:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d %d", &n, &a, &b); ^