栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

2020-09 CFF-CSP 风险人群筛查 C和C++混写

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2020-09 CFF-CSP 风险人群筛查 C和C++混写

2020-09 CFF-CSP 风险人群筛查 C和C++混写

前言
本次学习所用设备为微软Surface pro4,操作系统为windows10。

注意事项
(1)CFF-CSP考试提交一定要使用C++编译环境 。

题目

实现代码如下

#include
#include
using namespace std;
int x[1005] = {0};
int y[1005] = {0};
int main()
{
	int n,i,j;     //进行计数
	//输入第一行所需要的值 
	int k,t,xl,yd,xr,yu; 
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%d",&t);
	scanf("%d",&xl);
	scanf("%d",&yd);
	scanf("%d",&xr);
	scanf("%d",&yu);
	int result_first = 0;
	int result_second = 0;
	for(i = 1;i <= n;i++)
	{
		int count_first = 0;
		int number = 1;
		int count_flag[1005] = {0};
		int count_second[1005] = {0};
		for(j = 1;j <= t;j++)
		{
			scanf("%d",&x[j]);
			scanf("%d",&y[j]);
		}
		
		for(j = 1;j <= t;j++)
		{
			//属于区域 
			if((x[j] >= xl) && (x[j] <= xr) && (y[j] >= yd) && (y[j] <= yu)) 
		    {
			    count_first++;
			    count_flag[j]++;
		    }
		    //属于区域并且连续 
		    if((x[j] >= xl) && (x[j] <= xr) && (y[j] >= yd) && (y[j] <= yu) && (count_flag[j-1] == 1))
		    {
			    count_second[number]++;
			    if((count_second[number] + 1) >= k)
			    {
				    result_second++;
			    	break;
				}
		    }
		    else{
		    	number++;
			}
		   // printf("k=%d x[j]=%d y[j]=%d count_flag[%d]=%d count_first=%d count_second[number]=%d result_first=%d result_second=%dn",k,x[j],y[j],j,count_flag[j],count_first,count_second[number],result_first,result_second); 			
		}
		
		if(count_first != 0)
		{
			result_first++;
		}
	}
	printf("%dn",result_first);
	printf("%d",result_second);
	return 0;
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/655429.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号