解题报告
n和m跟木棍相交,问一人取一交点(必须是交点,且取完后去掉交点的两根木棍),最后谁赢
思路:
取最大正方形,以对角线上的交点个数判断输赢。
#include
#include
using namespace std;
int main()
{
int m,n;
while(cin>>n>>m)
{
if(n>m)
{...
分类:
其他好文 时间:
2014-07-25 11:18:01
阅读次数:
288
代码:#include #include //#include usingnamespacestd;intf[201];intmain(){//ifstreamcin("1050_input.txt");//调试用 intt,n,i,j,s,e;cin>>t;while(t--){memset(f,...
分类:
其他好文 时间:
2014-07-24 22:12:42
阅读次数:
185
代码:#includeusing namespace std;int main(){ int n,s,t1[100],t2[100],i,t,j; while(cin>>n) { if(n==0) break; s=1; for(i=0;i>t1[i]>>t2[i];for(i=0;it2[j]) ...
分类:
其他好文 时间:
2014-07-24 17:17:05
阅读次数:
191
1、cin>>s; s可以是:string s、char s[];
这个是ostream中的函数,遇到‘ ’(空格) , '\n'(换行),就会自动结束,因此如果用cin读取字符串,那么这个字符串中不能含有空格和换行。
cin因为不识别空格和换行,因此如果在输入字符串的时候,在字符开始处输入了空格或换行,没有任何影响。
#include
#include
#include
using...
分类:
编程语言 时间:
2014-07-24 11:36:13
阅读次数:
220
http://acm.hdu.edu.cn/showproblem.php?pid=2734思路挺简单的题目却折腾了好久,刚开始想把字符一个一个读进一个数组里,但却对开多大的数组产生了疑惑(后来看大神们的代码,普遍数组都开10000),便想避开,用c++的string直接cin,可是cin读字符串不...
分类:
其他好文 时间:
2014-07-24 11:25:22
阅读次数:
189
#include
#include
#include
using namespace std;
int main(){
ifstream in("E:\\read.txt");
string s;
int t=0,j,start;
int i=0;
while(getline(in,s)){
//cout<<s<<endl;
// t++;
for(j=...
分类:
其他好文 时间:
2014-07-24 10:37:01
阅读次数:
390
#include #include//get namespace related stuff using std::cin; using std::cout; using std::endl; using std::flush; using std::string; using std::vecto...
分类:
编程语言 时间:
2014-07-23 22:12:17
阅读次数:
350
本来不想写的以前写过一次没过现在每次打开HDU都会显示没完成看着不爽直接暴力肯定超时其实那数组遍历一次就可以了注意下标变化的条件 1 #include 2 3 using namespace std; 4 5 int main() 6 { 7 int T; 8 cin>>T; ...
分类:
其他好文 时间:
2014-07-23 14:46:56
阅读次数:
335
打表后可知,ball的值为1~p-1的循环;且只有第p-1个球不为0;所以,只有k/(p-1)个球不为0,且它们的值相等。 1 #include 2 using namespace std; 3 4 int main (){ 5 int k,p; 6 while (cin>>k>...
分类:
其他好文 时间:
2014-07-23 12:30:56
阅读次数:
178
大水题为了心情好点去写的结果思路很明确过程有点曲折超大数字的计算用字符串来解决换成减法也许会难点 1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 int T; 8 cin>>T; 9 i...
分类:
其他好文 时间:
2014-07-22 23:31:28
阅读次数:
292