在草稿纸上推演了很久
其实规律都写出来了,但我当时愣是没有发现,
推演找规律过程不要着急,回头看看,那就是规律
#include<bits/stdc++.h>
using namespace std;//一个新出生的 XX,半分钟之后吃掉 11 个 YY,并且,从此开始,每隔 11 分钟吃 11 个 YY。
//新出生的x过半分钟后,每1分钟吃
//x加倍后,余下的那部分继续1分钟y-,部分半小时后y-
int main(){
int x=10,y=89;
int t;
for(t=1;t<=120;t++){
if(t%2==1) y=y-x;
if(t%6==0) x=x*2;
if(t%4==0) y=y*2;
}
cout<<y<<endl;
return 0;}
另外,这个题系统测试时y=90
#include<bits/stdc++.h>
using namespace std;
int a[10]={0,1,2,3,4,5,6,7,8,9};
int main(){
do{
if((a[0]*10000+a[1]*1000+a[2]*100+a[3]*10+a[4])*a[5]==a[4]*10000+a[3]*1000+a[2]*100+a[1]*10+a[0])
{//cout<<a[5]<<endl;
cout<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]<<endl;
break;
}
}while(next_permutation(a,a+10));
return 0;}
黄金分割数 0.6180.618 与美学有重要的关系。舞台上报幕员所站的位置大约就是舞台宽度的 0.6180.618 处,墙上的画像一般也挂在房间高度的 0.6180.618 处,甚至股票的波动据说也能找到 0.6180.618 的影子…
黄金分割数是个无理数,也就是无法表示为两个整数的比值。0.6180.618 只是它的近似值,其真值可以通过对 55 开方减去 11 再除以 22 来获得,我们取它的一个较精确的近似值:0.6180340.618034。
有趣的是,一些简单的数列中也会包含这个无理数,这很令数学家震惊!
1\ 3\ 4\ 7\ 11\ 18\ 29\ 47 …1 3 4 7 11 18 29 47… 称为“鲁卡斯队列”。它后面的每一个项都是前边两项的和。
如果观察前后两项的比值,即:1/3,3/4,4/7,7/11,11/18 …1/3,3/4,4/7,7/11,11/18…会发现它越来越接近于黄金分割数!
你的任务就是计算出从哪一项开始,这个比值四舍五入后已经达到了与 0.6180340.618034 一致的精度。
请写出该比值。格式是:分子/分母。比如:29/4729/47。
【思路】double 类型
#include<bits/stdc++.h>
using namespace std;
int main(){
double a=1,b=3,c;
while(1){
if(a/b-0.618034<0.000001&&a/b>0.618034||a/b<0.618034&&0.618034-a/b<0.000001) break;
c=a;
a=b;
b=b+c;
}
cout<<a<<"/"<<b<<endl;
return 0;}
#include<bits/stdc++.h>
using namespace std;
int main(){
int y,day;
for(y=1900;y<2012;y++){
for(day=1;day<=30;day++){
int he=y*10000+6*100+day;
if(he%2012==0&&he%3==0&&he%12==0)
//cout<<y<<"06"<<day<<endl;
printf("%d06%.2d",y,day);
}
}
return 0;}
#include<bits/stdc++.h>
using namespace std;
double mji(double a,double b,double c){
double s=(a+b+c)/2;
double ans=sqrt(s*(s-a)*(s-b)*(s-c));
return ans;
}
int main(){
double ans=mji(52.1,68.2,33.4)+mji(68.2,57.2,71.9)+mji(71.9,51.9,43.5);
printf("%.2f",ans);
return 0;}
这个题比较值得做
标点符号,是中文的所以错了
还有系统测试的标点符号里面有个空格才会通过
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,index,temp;
int a[13];
memset(a,0,sizeof(a)); //初始化数组为 0
for(i=1,index=1;i<14;i++){
while(1){
if(a[index]==0){
a[index]=i;break;
}else index++;
}
temp=0;
while(1){
index++;
index=index%13;
if(a[index]==0) temp++;
if(temp==2 || i==13) break;
}
}
for(i=0;i<13;i++)
{ if(a[i]<=10&&a[i]!=1) printf("%d",a[i]);
else if(a[i]==1) printf("A");
else if(a[i]==11) printf("J");
else if(a[i]==12) printf("Q");
else printf("K");
if(i!=12) cout<<", ";
}
printf("\n");
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
long a;
a=pow(2,64)+1;
cout << a << endl;
return 0;
}
hhh,这个代码蓝桥杯测试通过了,但cb编译器运行结果是0,应该是爆了
而且蓝桥杯测试平台,+1还是-1他调式结果都一样,就很迷