4 solutions
-
1
小白写法,分类讨论
#include <stdio.h> int main() { long long a, b, c, sum = 0, sum2 = 0, temp=0; scanf("%lld %lld %lld", &a, &b, &c); if (b != 0) { for (int y = 0; y <= 10000; y++) { for (int x = 0; x <= 10000; x++) { if (y == -(c + a * x)*1.0/ b) sum += 1; } } }else if (a * c > 0) sum = 0; else if (a==0&&c==0) sum = 10001 * 10001; else if (a==0&&c!=0) sum =0; else if (a*c < 0) sum = 10001; printf("%lld\n", sum); return 0; }
- 1
Information
- ID
- 48
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 370
- Accepted
- 137
- Uploaded By