zoukankan      html  css  js  c++  java
  • hdu2069-2071

    hdu2069

    选取硬币组成定值,暴力

     1 #include<stdio.h>
     2 int v[6]={0,50,25,10,5,1};
     3 
     4 int main(){
     5     int n;
     6     while(scanf("%d",&n)!=EOF){
     7         int ans=0,ans1=0;
     8         for(int i=n/50;i>=0;i--){
     9             for(int j=(n-50*i)/25;j>=0;j--){
    10                 for(int k=(n-50*i-25*j)/10;k>=0;k--){
    11                     for(int q=(n-50*i-25*j-10*k)/5;q>=0;q--){
    12                         ans1=i+j+k+q+n-i*50-j*25-k*10-q*5;
    13                         if(ans1<=100)ans++;
    14                     }
    15                 }
    16             }
    17         }
    18         printf("%d
    ",ans);
    19 
    20     }
    21     return 0;
    22 }
    View Code

    hdu2070

    斐波那契数列

     1 #include<stdio.h>
     2 int main()
     3 {
     4     int n,i;
     5     long long a[51]={0,1};
     6     for (i=2;i<=50;i++) a[i]=a[i-1]+a[i-2];
     7     while (scanf("%d",&n)!=EOF&&n!=-1)
     8     {
     9         printf ("%I64d
    ",a[n]);
    10     }
    11     return 0;
    12 }
    View Code

    hdu2071

    求数列最大值

     1 #include<stdio.h>
     2 int main()
     3 {
     4     int t;
     5     while (scanf("%d",&t)!=EOF)
     6     {
     7         int i;
     8         for (i=1;i<=t;i++)
     9         {
    10             int n,j;
    11             scanf("%d",&n);
    12             double a[101],m;
    13             for (j=1;j<=n;j++) scanf("%lf",&a[j]);
    14             m=a[1];
    15             for (j=2;j<=n;j++) if (m<a[j]) m=a[j];
    16             printf("%.2lf
    ",m);
    17         }
    18     }
    19     return 0;
    20 }
    View Code
  • 相关阅读:
    html5的离线缓存
    html5的本地存储
    html5的地理位置定位
    html5新添加的表单类型和属性
    html5的鼠标拖拽
    win下svn常用操作笔记
    git常用命令笔记
    centos7下NFS使用与配置
    centos7下mysql5.6的主从复制
    centos7下创建mysql5.6多实例
  • 原文地址:https://www.cnblogs.com/cenariusxz/p/6578031.html
Copyright © 2011-2022 走看看