We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
링크
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; bool map[1002][1002] = { false, }; int gcd(int a, int b) { if (b > a) swap(a, b); int new_a = a, new_b = b; while (b != 0) { int temp = new_a%new_b; new_a = new_b; new_b = temp; } return new_a > 0 ? new_a : -new_a; } void solution() { int C, N; // basic line map[1][1] = 1; map[0][1] = 1; map[1][0] = 1; for (int y = 1; y <= 1000; y++) { for (int x = 1; x < y; x++) { int gcd_val = gcd(y, x); if (gcd_val == 1) { map[y][x] = 1; map[x][y] = 1; } else { int new_y = y / gcd_val; int new_x = x / gcd_val; map[new_y][new_x] = 1; map[new_x][new_y] = 1; } } } cout << "hello\n"; cin >> C; for (int i = 0; i < C; i++) { cin >> N; int count = 0; for (int y = 0; y <= N; y++) { for (int x = 0; x <= N; x++) { if (map[y][x]) count++; } } cout << count << "\n"; } cout << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solution(); return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
2725. 보이는 점의 개수
링크
설계
정리
고생한 점
코드
The text was updated successfully, but these errors were encountered: