zoukankan      html  css  js  c++  java
  • 重刷蓝桥杯基础题(五)

    闰年判断

    #include<bits/stdc++.h>
    using namespace std;
    
    //const int N=10001;
    int n;
    
    int main()
    {
    	cin>>n;
    	if(n%400==0||(n%4==0&&n%100!=0))
    		cout<<"yes"<<endl;
    	else cout<<"no"<<endl; 
    	return 0;
    }
    

    Fibonacci数列

    #include<bits/stdc++.h>
    using namespace std;
    
    const int N=1000001;
    int n;
    int f[N];
    
    int main()
    {
    	cin>>n;
    	f[0]=1;
    	f[1]=1;
    	for(int i=2;i<n;i++)
    		f[i]=(f[i-1]+f[i-2])%10007;
    	cout<<f[n-1]<<endl;
    	return 0;
    }
    

    园的面积

    #include<bits/stdc++.h>
    using namespace std;
    
    //const int N=1000001;
    #define PI 3.14159265358979323;
    int r;
    
    int main()
    {
    	cin>>r;
    	double ans=r*r*PI
    	cout<<fixed<<setprecision(7)<<ans<<endl;
    	return 0;
    }
    

    序列求和

    #include<bits/stdc++.h>
    using namespace std;
    
    int main()
    {
    	long long n;
    	cin>>n;
    	long long ans=(1+n)*n/2;
    	cout<<ans<<endl;
    	return 0;
    }
    
  • 相关阅读:
    [loj6484]LJJ爱数书
    [loj3163]动态直径
    [loj2983]数树
    [luogu3785]文本校正
    [loj2572]字符串
    [loj3103]节日庆典
    [atARC118F]Growth Rate
    [atARC118E]Avoid Permutations
    [cf794G]Replace All
    [cf756E]Byteland coins
  • 原文地址:https://www.cnblogs.com/longwind7/p/15559531.html
Copyright © 2011-2022 走看看