这是我第一题的代码,只通过了9%,麻烦大佬帮忙看一下问题出在哪里
#include<iostream> #include<vector> #include<cstdio> using namespace std; int main() { float n; int m; double r; cin >> n; cin >> m; cin >> r; float road = 0.00; for (int i = 0; i < m; i++) { float x = 0.00; float y = 0.00; road += r; int flag = road / n; int count = flag % 4; if (count == 0) { x = road - flag* n; y = 0.00; } else if (count == 1) { y = road - flag*n; x = n; } else if (count == 2) { x = road - flag *n; y = n; } else { x = 0.00; y = road - flag *n; } printf("%.2f %.2f\n", x, y); } return 0; }