Skip to content

added answer codes - #3

Open
mizti wants to merge 1 commit into
granparkrb:masterfrom
mizti:miz_answer_temp
Open

added answer codes#3
mizti wants to merge 1 commit into
granparkrb:masterfrom
mizti:miz_answer_temp

Conversation

@mizti

@mizti mizti commented Jan 27, 2013

Copy link
Copy Markdown

C++でブログ掲載の解法を書いてみました。
答えはだいたい0.00397697くらいになるようです。

@hamakn

hamakn commented Jan 27, 2013

Copy link
Copy Markdown
Contributor

おお、3人そろったのでたぶん合ってそうっすね 🍢

ところで、手持ちのMBAだとコンパイルエラーになってしまいます(´;ω;`)

% g++ a.cpp
a.cpp: In member function ‘long long int CrazyGin::untilKillKing(int)’:
a.cpp:34: error: scalar object ‘moveX’ requires one element in initializer
a.cpp:35: error: scalar object ‘moveY’ requires one element in initializer
a.cpp:38: error: scalar object ‘friendPosX’ requires one element in initializer
a.cpp:39: error: scalar object ‘friendPosY’ requires one element in initializer
a.cpp: In member function ‘long long int CrazyGin::afterKillKing(int)’:
a.cpp:71: error: scalar object ‘moveX’ requires one element in initializer
a.cpp:72: error: scalar object ‘moveY’ requires one element in initializer
a.cpp:75: error: scalar object ‘friendPosX’ requires one element in initializer
a.cpp:76: error: scalar object ‘friendPosY’ requires one element in initializer

% g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

あと、できれば、フォルダの移動(miztiフォルダを作るとか)と、
インデントの整形をお願いしたいです。

@inaz2

inaz2 commented Feb 9, 2013

Copy link
Copy Markdown
Contributor

a.cppはC++0x (C++11) で書かれているようなので、次のようにオプションをつければコンパイルできます(cygwin上でやっているのでa.outの代わりにa.exeになってます)。

$ g++ -std=c++0x a.cpp
$ ./a.exe
0.00397697

$ g++ --version
g++ (GCC) 4.5.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

マージしようと思ったんですけど、作法がよくわからないのであとはお願いします!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants