UVA 10167
来源:互联网 发布:房产中介软件xiazaiba 编辑:程序博客网 时间:2024/05/29 21:28
题目大意:蛋糕上有2*N个樱桃,切一刀,使得蛋糕两半的樱桃个数相同,不能切到樱桃。
解题思路:两个循环,暴力解决。
ac代码:
#include <iostream>using namespace std;int n, x[105], y[105], jud, cnt1, cnt2;int main(){while (scanf("%d", &n)!=EOF && n){for (int i=0; i<2*n; i++)scanf("%d%d", &x[i], &y[i]);jud = 0;for (int i=-500; i<=500; i++)for (int j=-500; j<= 500; j++){cnt1 = cnt2 = 0;for (int k=0; k<2*n; k++){if (x[k] * i + y[k] * j > 0)cnt1++;if (x[k] * i + y[k] * j < 0)cnt2++;}if (!jud && cnt2 == cnt1 && cnt1 == n){printf("%d %d\n", i, j);jud = 1;} }} return 0;}
阅读全文
0 0
- UVA 10167
- Uva 10167
- uva 10167
- uva 10167
- UVA 10167
- UVa 10167 - Birthday Cake
- UVa:10167-birthday cake
- UVA 10167 Birthday Cake
- uva 10167 - Birthday Cake
- UVa 10167 Birthday Cake
- uva 10167 - Birthday Cake
- UVa 10167 Birthday Cake
- uva 10167 - Birthday Cake
- UVa 10167 - Birthday Cake
- UVA 10167 生日蛋糕
- uva-10167 - Birthday Cake
- UVA 10167 - Birthday Cake
- uva 10167 Birthday Cake
- WebRTC带宽估计
- tf.image.crop_to_bounding_box的用法
- supervisor uwsgi配置文件
- Redis-Study-tips-1-环境搭建
- 自定义漂亮的Android SeekBar样式
- UVA 10167
- 布局笔记
- [译文]深入理解JavaScript的this关键字(一)
- OracleDBA之数据库管理
- Angular表单验证
- 【代码】AIchallenger_ImageCaption_json转换为mscoco格式
- 剑指offer面试题25 二叉树中和为某一值的路径
- java 相对路径问题
- 哪种Linux发行版适合程序员做开发?