POJ 1247
来源:互联网 发布:虚拟乐器软件 编辑:程序博客网 时间:2024/06/13 16:03
纯粹水题。
代码如下:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
while(cin>>n&&n)
{
int i,a[31],q=0;
for(i=0;i<n;i++)
{
cin>>a[i];
q+=a[i];
}
if(q%2==1) cout<<"No equal partitioning."<<endl;
else
{
int m=q/2,p=0;
for(i=0;i<n;i++)
{
p+=a[i];
if(p==m)
{
cout<<"Sam stops at position "<<i+1<<" and Ella stops at position "<<i+2<<'.'<<endl;
break;
}
else if(p>m)
{
cout<<"No equal partitioning."<<endl;
break;
}
}
}
}
return 0;
}
- POJ 1247
- poj 1247
- POJ-1247
- POJ-1247
- poj 1247
- POJ 1247 Magnificent Meatballs
- poj 1247 暴力
- poj 1247 Magnificent Meatballs
- POJ 1247 Magnificent Meatballs
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- iOS 5的StoryBoard
- 设置导航条和tabbar隐藏
- iOS 开发者必知的 75 个工具
- 字节序(Endian),大端(Big-Endian),小端(Little-Endian)
- C#数据分页实现(非控件)
- POJ 1247
- What is VSWR(电压驻波比/驻波比)?
- 性能提升100倍的秘密武器:一行SQL代码的妙用
- 关于tomcat startup.bat启动后一闪而过的问题(转)
- jasig cas单点登录配置笔记之二
- BZoj 1500 [NOI2005]维修数列 (Splay 模板)
- CSliderCtrl
- HDU 3033(分组背包)
- C++完整笔记