//10250 The Other Two Tree#include <stdio.h> void main() { double x0, y0, x1, y1; double x2, y2, x3, y3; double cx, cy; while((scanf("%lf%lf%lf%lf", &x0, &y0, &x1, &y1)) != EOF) { if(x0 == x1 && y0 == y1) printf("Impossible."); else { cx = (x0 + x1) / 2; cy = (y0 + y1) / 2; x2 = -(y0 - cy); y2 = x0 - cx; //向量旋转 x3 = -x2; y3 = -y2; printf("%.10lf %.10lf %.10lf %.10lf", x2+cx, y2+cy, x3+cx, y3+cy); } } }
//submit多次,换了方法,还是不行,又以为是精度问题,还不行,最后发现是输出格式的问题,最后的printf要加'\n'。快要吐血……
//10050 Hartals
#include <stdio.h> #include <string.h> int d[4000]; int h[101]; int a[100]; void main() { int t,q; scanf("%d", &t); q = t; while(t) { int i, j, n, p; scanf("%d%d", &n, &p); for(i = p; i > 0; i--) { scanf("%d", &h[i]); } memset(d, 0, sizeof(d)); for(i = 1; i <= n; i++) for(j = p; j > 0; j--) if(i % h[j] == 0) if(i % 7 != 6 && i % 7 != 0) d[i] = 1; for(i = 1, a[t] = 0; i <= n; i++) a[t] += d[i]; t--; } for(; q > 0; q--) printf("%d\n", a[q]); }
//一开始题目中的average number of days没弄清,百度之发现是罢工周期,每Hi天罢工一次。//前两次提交时,皆为COMPILATION ERROR,一次是stray\32,出现不明字符,应该是复制粘贴时带上的;第二次是
code.cpp:6:11: error: '::main' must return 'int' code.cpp: In function 'int main()': code.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result code.cpp:14:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result code.cpp:17:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_un//用的是void mian() ,结果C++不行,换为ANSI C格式提交就没问题了。
附图:
新手UVa 10250 The Other Two Tree && 10050 Hartals
最新推荐文章于 2020-04-25 10:21:15 发布