标签:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <cstdlib>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main()
{
int i,j,ans=0,p,t,flag;
for(i=10000;i<100000;i++)
{
t=i;
flag=0;//??4
while(t!=0)
{
if(t%10==4)
{
flag=1;
break;
}
t/=10;
}
if(flag==0)
{
ans++;
//cout<<i<<" ";
}
}
cout<<ans<<endl;
system("pause");
return 0;
}2017-08-05
可惜我算错了- -
1085
buf[width-2]==0?0:(width-2-strlen(s))/2,buf[width-2]==0?"":" ",buf,buf[width-2]==0?0:(width-1-strlen(s))/2,buf[width-2]==0?"":" "
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <cstdlib>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main()
{
int i,j;
for(i=1;i<46;i++)
{
for(j=i+2;j<=49;j++)
{
int t=i*(i+1)+j*(j+1)-(i*2+2+j*2);
if(t==790)
cout<<i<<" "<<j<<endl;
}
}
system("pause");
return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <cstdlib>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main()
{
int i[20];
long long ans=0;
for(i[1]=0;i[1]<=4;i[1]++)
for(i[2]=0;i[2]<=4;i[2]++)
for(i[3]=0;i[3]<=4;i[3]++)
for(i[4]=0;i[4]<=4;i[4]++)
for(i[5]=0;i[5]<=4;i[5]++)
for(i[6]=0;i[6]<=4;i[6]++)
for(i[7]=0;i[7]<=4;i[7]++)
for(i[8]=0;i[8]<=4;i[8]++)
for(i[9]=0;i[9]<=4;i[9]++)
for(i[10]=0;i[10]<=4;i[10]++)
for(i[11]=0;i[11]<=4;i[11]++)
for(i[12]=0;i[12]<=4;i[12]++)
for(i[13]=0;i[13]<=4;i[13]++)
{
int t=0;
for(int j=1;j<=13;j++)
t+=i[j];
if(t==13)
ans++;
}
cout<<ans<<endl;
system("pause");
return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>
#include <cstdlib>
#include <cmath>
using namespace std;
int map[10005][10005];
int main()
{
int i,j,w,m,n,t,mi,mj,ni,nj;
while(cin>>w>>m>>n)
{
int cnt=1;
if(m==n)
{
cout<<0<<endl;
continue;
}
else if(m>n)
t=m,m=n,n=t;
for(i=0;i<100001;i++)
{
if(i%2)
{
for(j=w-1;j>=0;j--)
{
map[i][j]=cnt;
if(cnt==m)
{
mi=i;
mj=j;
}
if(cnt==n)
{
ni=i;
nj=j;
goto flag;
}
cnt++;
}
}
else
{
for(j=0;j<w;j++)
{
map[i][j]=cnt;
if(cnt==m)
{
mi=i;
mj=j;
}
if(cnt==n)
{
ni=i;
nj=j;
goto flag;
}
cnt++;
}
}
}
flag:cout<<abs(mi-ni)+abs(mj-nj)<<endl;
}
return 0;
}最后两题么没有全写。
标签:
原文地址:http://blog.csdn.net/a120705230/article/details/45009213