zoukankan      html  css  js  c++  java
  • 白皮 Chapter 2

    7.2 做题一遍就过的感觉简直太美好啦~然而我并没有测试数据QAQ

    //program name digit
    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main()
    {
        int a,count=0;
        cin>>a;
        while (a>0){
            a=a/10;
            count++;
        }
        cout<<count;
        return 0;
    }
    digit
    //program name daffodil
    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main()
    {
        int a,b,c;
        for (a=1;a<=9;a++)
            for (b=0;b<=9;b++)
                for (c=0;c<=9;c++)
                    if (a*a*a+b*b*b+c*c*c==100*a+10*b+c) cout<<100*a+10*b+c<<"
    ";
        return 0;
    }
    daffodil
    //program name hanxin
    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main()
    {
        int a,b,c,i;
        cin>>a>>b>>c;
        for (i=10;i<=100;i++)
            if (i % 3==a && i % 5==b && i % 7==c)
            {
                cout<<i<<"
    ";
                break;
            }
        if (i==101) cout<<"No answer";
        return 0;
    }
    hanxin
    //program name triangle
    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main()
    {
        int n,i,j;
        cin>>n;
        for (i=1;i<=n;i++)
        {
            for (j=1;j<=i-1;j++) cout<<" ";
            for (j=1;j<=2*(n-i)+1;j++) cout<<"#";
            cout<<"
    ";
        }
        return 0;
    }
    triangle

    7.3 要坚持练语法打下扎实基础啊~

  • 相关阅读:
    OpenGL------光照+染色
    sicily 1345 能量项链
    sicily 1193 Up the Stairs
    sicily 1172 Queens, Knights and Pawns
    sicily 1206 Stacking Cylinders
    模拟退火算法解tsp问题
    js对象的属性可以是一个变量
    vue中/deep/的使用
    MySQL中DATEDIFF函数使用
    js中的this
  • 原文地址:https://www.cnblogs.com/Sky-Grey/p/4617494.html
Copyright © 2011-2022 走看看