新手UVa 10250 The Other Two Tree && 10050 Hartals

//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格式提交就没问题了。


附图:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值