UVA 10167 - Birthday Cake

基于Swin Transformer与小波时频分析的轴承故障智能诊断 深度学习在工业设备故障诊断领域展现出强大潜力,其中时频分析技术能有效捕捉振动信号的非平稳特性。小波变换凭借其可调的时频分辨率,特别适合处理轴承故障产生的冲击型信号。结合Swin Transformer的窗口注意力机制,可以高效建模时频图中的长程依赖关系。这种端到端的智能诊断方案在噪声环境下表现出优异鲁棒性,准确率可达98.3%,比传统方法提升37%的早期故障检测灵敏度。该技术已成功应用于风机齿轮箱监测等工业场景,满足200ms内的实时诊断需求。 阅读详情

Background

Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is at (0,0), and the cake's length of radius is 100.

There are 2N (N is a integer, 1<=N<=50) cherries on the cake. Mother wants to cut the cake into two halves with a knife (of course a beeline). The twins would like to be treated fairly, that means, the shape of the two halves must be the same (that means the beeline must go through the center of the cake) , and each half must have N cherrie(s). Can you help her?

Note: the coordinate of a cherry (x , y) are two integers. You must give the line as form two integers A,B(stands for Ax+By=0), each number in the range [-500,500]. Cherries are not allowed lying on the beeline. For each dataset there is at least one solution.

Input

The input file contains several scenarios. Each of them consists of 2 parts: The first part consists of a line with a number N, the second part consists of 2N lines, each line has two number, meaning (x,y) .There is only one space between two border numbers. The input file is ended with N=0.

Output

For each scenario, print a line containing two numbers A and B. There should be a space between them. If there are many solutions, you can only print one of them.

Sample Input

2
-20 20
-30 20
-10 -50
10 -5
0

Sample Output

0 1

总结问题:
1 产生a,b 用两个for,没用随机数,导致WA
2 没有用while 和n=0的判断,WA
3 数组开的太小了,WA


#define RUN
#ifdef RUN

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <cctype> 
#include <algorithm>
#include <utility>
#include <math.h>
#include <ctime>

using namespace std;

#define MAXN 110

int input[MAXN][2];
int n;

void printout(){
	cout << "2*n:" << 2*n << endl;
	for(int i=0; i<2*n; i++){
		printf("%d %d\n", input[i][0], input[i][1]);
	}
}


void play(){
	
	int pos=0, neg=0;

	while(true){
		int a = -500 + (rand()%1001);
		int b = -500 + (rand()%1001);

		pos = 0;
		neg = 0;
		for(int k=0; k<2*n; k++){
			int sign = a*input[k][0] + b*input[k][1];
			if(sign > 0){
				pos++;
			}
			else if(sign < 0){
				neg++;
			}

			if(pos>=n && neg>=n){
				printf("%d %d\n", a, b);
				return;
			}
		}
	}
}


int main(){

#ifndef ONLINE_JUDGE
	freopen("10167.in", "r", stdin);
	freopen("10167.out", "w", stdout);
#endif

	srand ( time(NULL) );
	while(scanf("%d",&n)==1 && n!=0){
		memset(input, 0, sizeof(input));
		for(int i=0; i<2*n; i++){
			scanf("%d%d", &input[i][0], &input[i][1]);
		}
		play();
		//printout();
	}
	
	return 0;
}


#endif


【OpenBMC 系列】4.启动流程 使用qume模拟ast2600-evb 1.安装openbmc适配的qume 2.启动bmc 3.使用bmc web 阅读详情

相关推荐

AI时代敏捷开发新范式——意图驱动开发IDD

具体的功能代码、单元测试、集成测试用例,以及最终可运行的、支持PlantUML的Markdown转Word工具新版本。:业务方(如技术文档团队)反馈,现有的Markdown转Word工具在处理包含PlantUML代码块的文档时,无法正确生成图表,导致技术方案、架构图等关键信息丢失,严重影响了文档交付质量和团队效率。这不仅带来了交付周期显著缩短、资源效能倍增的可观收益,更深远的意义在于,它描绘了未来软件工业化、智能化的新图景:一个由精准意图驱动、AI自主执行、人类智慧引领的敏捷、高效、高质的新世界。

LiuJunjiang的专栏 550

uva 10167 - Birthday Cake

点击打开链接 题目意思:给定一个半径为100的蛋糕,蛋糕上面有许多的樱桃,现在要求一次性平均分蛋糕,并且对应的樱桃的数量要相等。要求这个均分的直线AX+BY = 0的A 和 B的一个解 解题思路:题目规定半径的值,还有A B 的范围,我们知道一条直线能够将点平均分成两半 ,点不会落在直线上,那么我们知道对于点带入直线如果值大于0则点在直线上方,反之在下方。 只要慢足上方的点等于下方的...

我是传奇 218

SIwave仿真手册——信号完整性仿真之S参数的提取(二)

上一篇简单了讲述了软件的各个操作界面,本次博客更新关于的仿真,因为第二章完整的内容比较多,所以分成好几篇博客进行分享。

luohuo9844的博客 1万+

UVA 10167 Birthday Cake

UVA 10167 Birthday Cake题目大意:给出几个坐标点,要求Ax+By = 0(-100 <= A/B <= 100)能将坐标点对半分解题思路:枚举全部情况,直到能够分开为止#include <stdio.h> #include <iostream> using namespace std; int n; int point[110][2]; int num; void pro()

ZeroLH00的博客 342

Halcon 20.11在WPF中的交互式绘图:完整实现矩形ROI的创建、拖动与坐标获取

本文详细介绍了如何在WPF框架下利用Halcon 20.11实现交互式矩形ROI的创建、拖动与坐标获取。通过HDrawingObject和HSmartWindowControlWPF控件,开发者可以高效构建机器视觉应用,提升项目实战中的开发效率。文章涵盖环境配置、事件处理、坐标获取及性能优化等关键内容。

weixin_29266007的博客 427

开源网格划分软件-Gmsh二次开发教程 (4)网格生成与控制​

​本章将深入讲解Gmsh的网格生成技术,包括全局/局部网格控制、边界层生成、自适应细化等,并提供完整的代码示例。

ZQGG的博客 1472

uva 10167 Birthday Cake

Problem G. Birthday Cake  Background Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center

不慌不忙、不急不躁 1401

嵌入式开发 DSP芯片运行方式(挖坑-填坑中-坑已平 :))

TMS320F28335 DSP 芯片 如何将运行代码放在不同的位置

FOOLCODE的专栏 1305

UVA10167 Birthday Cake【暴力】

Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them. Now we put the cake onto a Descartes coordinate. Its center is at (0, 0), and the cake’s length of radius is 100...

海岛Blog 989

kaggle——销量预测的baseline(M5 Forecasting - Accuracy)

前言 在刚刚结束的kaggle比赛M5 Forecasting - Accuracy中,因为是第一次参加,笔者也是花了大量的时间和精力在上面,最终拿到一块银牌(所以我拿到了大学第一个考试挂科。。。求求电磁场老师高抬贵手给点平时分放我一马吧。。。早上看到kaggle成绩异常兴奋,中午考完直接爆炸=。=),当然运气占了很大因素,这次比赛private leadboard的shake up非常大,排名波动几千名都存在的。笔者运气不错,是向上的shake:)。这里总结一下销量预测的基本流程。 从下图可以看到这次比

weixin_43901221的博客 5431

【论文精读】Graph WaveNet-深度时空图模型

Graph WaveNet构建了一个自适应邻接矩阵,它能保留隐藏的空间依赖关系,能够自动从数据中发现未见的图结构。提出了一个有效且高效的框架,可同时捕捉空间和时间依赖关系。其核心思想是将其提出的图卷积与扩张因果卷积相结合,使每个图卷积层都能处理空间依赖关系。在交通数据集上评估了提出的模型,并以较低的计算成本获得了最先进的结果。

打酱油的葫芦娃 1007

UVA 10167 Birthday Cake

UVA-10167题意:给出2N 个点,求AB为多少时,Ax+By=0 把点分成相等的两部分。 解题思路:暴力枚举,把点带入直线方程,大于0的是一边,小于0的是另外一边。/************************************************************************* > File Name: UVA-10167.cpp > Aut

QzNarsh的博客 476

古风仙侠少女三视图提示词,一键生成角色设定

3D中国写实CG风格,CG渲染质感,精细3D建模,PBR物理材质,细腻服装纹理,电影级灯光,丰富表情,高精度场景,次世代引擎画质。平视正交视角,统一光照,纯白背景,无文字无水印,避免强透视和动态变形。3D中国写实CG风格,CG渲染质感,精细3D建模,PBR物理材质,细腻服装纹理,电影级灯光,丰富表情,高精度场景,次世代引擎画质。3D中国写实CG风格,CG渲染质感,精细3D建模,PBR物理材质,细腻服装纹理,电影级灯光,丰富表情,高精度场景,次世代引擎画质。少女,古风仙侠少女气质,灵动、温婉、仙气。

欢迎来到鸾姝淡月博客,专为程序员和编程爱好者打造的技术博客。我们分享编程语言趋势、开发工具、编程哲学、职业发展等,助你掌握新技术,优化技能,激发编程热情。 1025

uva10167 Birthday Cake

Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them. Now we put the cake onto a Descartes coordinate. Its center is at (0;0), and the cake's length of radius is 1

keshuqi的博客 406

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

【UVa10167】 Birthday Cake,思路+代码+解题报告

#include #include #include #include // #define INPUT /** Problem: UVA10167 - Birthday Cake Begin Time:22nd/Mar/2012 5:00 p.m. End Time: 22nd/Mar/2012 7:35 p.m. Last Time: 2H 35M

c0de4fun的完美算(nei)法(he)教室-我们仍不知道,那天调用的驱动的名字。 3044

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Uva 10167 Birthday cake

题目的大概意思是妈妈要给两个孩子分蛋糕,要求分到的樱桃数量公平相同 就是输入了2n个坐标点,找到一条直线,能够平分这些点 从题目来看,数字的量要求不是那么大,对于方法,显然的方法就是简单的枚举,算做是简单的题目

D's Blog 826

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

UVa 10167 - Birthday Cake

传送门UVa 10167 - Birthday Cake 暴力第一题,思路很简单,两个for循环就

一只冰熊 764

UVA10167 Birthday Cake

刚刚开始被坑 没发现不能在线上

sdf123s的专栏 458

uva-10167 - Birthday Cake

题意:给你一系列的点,让你找出一条直线AX+BY=0,使直线把这一系列的点分为两个部分。 由于A,B的范围在-500~500之间,所以直接枚举就可以了。 反思:由于没仔细看题意,If there are many solutions, you can only print one of them.这句话让我吃亏了。 调试的程序和Sample Output 不一样,然后就纠结了老久。。。。#

青竹梦 1829

UVA10167-Birthday Cake

题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=1108   package D0810; import java.util.*; /* * 题目大意:有一个蛋糕,上面有2N个樱桃,切一刀,使得每块蛋糕有n个樱

lhfight的专栏 635

UVA 10167 Birthday Cake(判断点在直线的哪边)

UVA 10167 Birthday Cake(判断点在直线的哪边) 题意:        在一个二维平面上,有一个以(0,0)为圆心的圆,现在圆内有很多整点,现在要你找出一条这样直线AX+BY=0,使得所有整点正好在直线的两边。要你输出A和B,且A和B都属于[-500,500]范围。 分析:        由于A和B都是整数且数据范围比较小,所以我们直接枚举A和B的值即可.      

code 1060

uva10167Birthday Cake

题目复制过来格式有错就不复制了 给一块蛋糕 一堆樱桃 求一条直线能够平分所有的樱桃 即有一半的樱桃在线的上方,一半在下方 樱桃不能在线上 0ut 0 1

katydid3018的博客 410
上一篇: UVA 10167 - Birthday Cake
下一篇: qsort()应用大全
chiiis
博客等级 码龄14年 422粉丝 429原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值