結果

問題 No.113 宝探し
ユーザー 👑 p-adic
提出日時 2022-08-08 15:22:31
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 827 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 72,880 KB
最終ジャッジ日時 2025-01-30 19:25:54
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;

using uint = unsigned int;
using ll = long long;

#define CIN( LL , A ) LL A; cin >> A 
#define GETLINE( A ) string A; getline( cin , A ) 

int main()
{

  CIN( string , S );
  const uint& size = S.size();
  ll x = 0;
  ll y = 0;
  
  for( ll i = 0 ; i < size ; i++ ){

    const string s = S.substr( i , 1 );

    if( s == "N" ){

      y++;

    } else if( s == "E" ){

      x++;

    } else if( s == "W" ){

      x--;

    } else if( s == "S" ){

      y--;
      
    }

    
  }

  const ll R2 = ( x * x + y * y ) * 10000;

  for( ll r = 0 ; r <= R2 ; r++ ){

    if( r * r >= R2 ){

      const double d = r / 100.0;
      cout << d << endl;
      return 0;

    }

  }

  return 0;

}
0