这是我第一题的代码,只通过了9%,麻烦大佬帮忙看一下问题出在哪里 #include<iostream> (5488)#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; }
点赞 2

相关推荐

死在JAVA的王小美:哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈,我也是,让我免了一轮,但是硬气拒绝了
点赞 评论 收藏
分享
牛客279957775号:铁暗恋
点赞 评论 收藏
分享
牛客网
牛客企业服务