Created
July 2, 2014 07:08
-
-
Save cocodrips/a4838f6121d6b1648f12 to your computer and use it in GitHub Desktop.
pairの配列を作りたい
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <utility> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| const int N = 5; | |
| int main(int argc, char const *argv[]) | |
| { | |
| pair<int, int> areas[N*N]; | |
| for (int i = 0; i < N; ++i) | |
| { | |
| for (int j = 0; j < N; ++j) | |
| { | |
| pair<int, int> p; | |
| p.first = i * i + j * j; | |
| p.second = i; | |
| areas[i * N + j] = p; | |
| } | |
| } | |
| for (int i = 0; i < N * N; ++i) | |
| { | |
| cout << areas[i].first << endl; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment