zoukankan      html  css  js  c++  java
  • 暑假第八周

    这周完成了对pta的扫尾工作,以及网页的简单制作。

    一、pta

    1037:

    #include<stdio.h>
    int price[3] = { 0 };
    int b[3] = { 0 };
    int main()
    {
        scanf("%d.%d.%d", &price[0], &price[1], &price[2]);
        scanf("%d.%d.%d", &b[0], &b[1], &b[2]);
        int i = 0, sum = 0;
        for (;i < 3;i++)
        {
            b[i] = b[i] - price[i];
        }
        sum = b[0] * 17 * 29 + b[1] * 29 + b[2];
        int flag = 0;
        if (sum < 0)
        {
            flag = 1;
            sum = -1 * sum;
        }
        b[2] = sum % 29;
        b[1] = (sum / 29) % 17;
        b[0] = sum / 29 / 17;
        if (flag == 1)
            b[0] = -1 * b[0];
        printf("%d.%d.%d", b[0], b[1], b[2]);
        return 0;
    }
    1038:
    #include <iostream>
    using namespace std;
    int gra[101];
    int main()
    {
        int n,t;
        cin >> n;
        for (int i = 0; i < n; ++i) {
            cin >> t;
            gra[t]++;
        }
        int k;
        cin >> k;
        for (int i = 0; i < k; ++i) {
            cin >> t;
            cout << gra[t];
            if(i!=k-1)
            cout << " ";
        }
        return 0;
    }
    1046:
    #include<iostream>
    using namespace std;
    int main()
    {
        int num;
        int a[4];
        int i, j;
        static int win1 = 0, win2 = 0;
        cin >> num;
        for (i = 0;i < num;i++)
        {
            for (j = 0;j < 4;j++)
            {
                cin >> a[j];
            }
            if ((a[1] == a[0] + a[2]) && (a[3] != a[0] + a[2]))
                win2++;
            if ((a[3] == a[0] + a[2]) && (a[1] != a[0] + a[2]))
                win1++;
        }
        cout << win1 << " " << win2 ;
        return 0;
    }
    1056:
    #include<iostream>
    using namespace std;
    int main()
    {
        int a[10], b, i, j, sum = 0;
        cin >> b;
        for (i = 0;i < b;i++)
            cin >> a[i];
        for (i = 0;i < b;i++)
        {
            for (j = 0;j < b;j++)
            {
                if (j == i)
                    continue;
                else
                    sum += a[i] * 10 + a[j];
            }
        }
        cout << sum;
    }
    1057:
    #include <iostream>
    #include <cctype>
    #include <string>
    using namespace std;
    int main()
    {
        string s;
        getline(cin, s);
        int n = 0;
        int l = s.length();
        for (int i = 0; i < l; i++)
        {
            if (isalpha(s[i]))
            {
                s[i] = toupper(s[i]);
                n += (s[i] - 'A' + 1);
            }
        }
        int a = 0, b = 0;
        while (n != 0)
        {
            if (n % 2 == 0)
                a++;
            else
                b++;
            n /= 2;
        }
        cout << a<< " " << b;
        return 0;
    }
    1069:
    #include<iostream>
    #include <string.h>
    using namespace std;
    int main()
    {
        char a[1000][21] = { {0} }, line[21];
        int M, N, S, m, c = 0, r = 0;
        cin >> M >> N >> S;
        for (m = 0,S--; m < M; m++)
        {
            cin >> line;
            if (m == S + c * N + r)
            {
                int b = 1;
                for (int i = 0; i < c && b; i++)
                    if (!strcmp(a[i], line))
                    {
                        b = 0;
                        r++;
                        break;
                    }
                if (b)
                    strcpy(a[c++], line);
            }
        }
        for (int i = 0; i < c; i++)
            cout << a[i] << endl;
        if (!c)
            cout<<"Keep going...";
        return 0;
    }
    1071:
    #include<iostream>
    using namespace std;
    int main()
    {
        int T, k;
        cin >> T >> k;
        int a, b, c, d;
        while (k--)
        {
            cin >> a >> b >> c >> d;
            if (c > T&&T != 0)
            {
                cout << "Not enough tokens.  Total = " << T << "." << endl;
            }
            else
            {
                if ((b == 0 && d < a) || (b == 1 && d > a))
                {
                    T += c;
                    cout << "Win " << c << "!  Total = " << T<<"." << endl;
                }
                else
                {
                    T -= c;
                    cout << "Lose " << c << ".  Total = " << T << "." << endl;
                }
                if (T == 0)
                {
                    cout<<"Game Over."<<endl;
                    break;
                }
            }
        }
        return 0;
    }
    1081:
    #include<iostream>
    #include<string>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        string s;
        getchar();
        int a = 0, b = 0, c = 0, d = 0;
        while (n--) {
            getline(cin, s);
            if (s.length() < 6) {
                cout << "Your password is tai duan le." << endl;
            }
            else {
                for (int i = 0;i < s.length();i++) {
                    if (isdigit(s[i]))
                        a = 1;
                    else if (isalpha(s[i]))
                        b = 1;
                    else if (s[i] == '.')
                        c = 1;
                    else
                        d = 1;
                }
                if (d)           //情况d
                    cout << "Your password is tai luan le." << endl;
                else if (b&&a == 0)    //情况c
                    cout << "Your password needs shu zi." << endl;
                else if (a&&b == 0)    //情况b
                    cout << "Your password needs zi mu." << endl;
                else     //正确
                    cout << "Your password is wan mei." << endl;
            }
            a = 0, b = 0, c = 0, d = 0;
        }
        return 0;
    }
    二、网页制作
    <!doctype html>
    <html>
    <head>
    <title>小闫的简略购物网站</title>
    <style type="text/css">
    #home{
    margin-top:35px;
    1350px;
    heigh:85px;
    bacaground:#9c9;
    }
    #home ul
    li{
    list-stype-type:none;
    float:right;
    }
    #home ul
    li input{
    heigh:19px;
    85px;
    color:#000000;<!--为搜索栏部分-->
    }
    #home p{
    padding-top:19px;
    font-size:29px;
    font-family:"黑体";
    color:#EA0000;
    display:block;
    130px;
    border-left:#000000 solid 3px;
    border-right:#000000 solid 3px;
    height:48px;
    padding-left:8px;
    margin-left:25px;
    }
    #home ul{
    float:right;
    diaplay:block;
    height:15px;
    200px;
    margin-right:15px;
    margin-top:-32px;
    }
    #menu{
    margin-top:-12px;
    font-family:"微软雅黑";
    1350px;
    height:29px;
    border:#EA0000 solid 3px;
    }
    #menu ul{
    margin-left:135px;
    }
    #menu ul
    li{
    float:left;
    list-style-type:none;
    }
    #menu ul
    li a{
    color:#e92f97;
    padding-top:3px;
    padding-left:15px;
    text-decoration:none;
    padding-left:15px;
    margin-top:-12px;
    display:block;
    height:35px;
    85px;
    }   <!--为首页菜单栏部分-->
    #homePage1{
    background:#FOF;
    }
    #homePage{
    height:465px;
    1000px;
    margin-top:-400px;
    margin-left:-190px;
    }   
    #dlist dl{
    float:left;
    margin:15px;
    }
    #dlist{
    1100px;
    height:400px;
    margin-left;170px;
    margin-top:12px;
    }
    #dlist1 p{
    font-size:25px;
    font-family:"微软雅黑";
    color:#FOF;
    }
    #dlist2 dl{
    float:left;
    margin:15px;
    }
    #dlist2{
    1100px;
    height:400px;
    margin-left;170px;
    margin-top:12px;
    }
    #dlist3 dl{
    float:left;
    margin:15px;
    }
    #dlist3{
    1100px;
    height:400px;
    margin-left;170px;
    margin-top:12px;
    }
    #dlist4{
    margin-top:15px;
    }
    #dlist4 p{
    font-size:23px;
    font-famliy:"微软雅黑";
    color:FOF;
    }
    #buttom{
    padding-top:12px;
    margin-left:171px;
    margin-top:340px;
    height:50px;
    1250px;
    }//
    #buttom ul
    li {
    list-stype-type:none;
    float:left;
    }//
    #buttom ul
    li a{
    color:#000000;
    text-decoration:none;
    diaplay:block;
    100px;
    height:25px;
    }
    #buttom1, span, em{
    backgrouond:#93C;
    }
    </style>
    <script type="text/javascript">
    var n=1;
    function img1(){
    if(n==1){
    myForm.imgflash.src="2.jpg";}
    if(n==3){
    myForm.imgflash.scr="1.jpg";}
    if(n==4){
    myForm.imgflash.scr="1.jpg";
    n=0;
    }bgt
    n++;
    }
    window.setlnterval("img1()",4500);
    function openning() {
    windoe.open("openning.html");
    }
    </script>
    </head>
    <body>
    <div id="home">
    <p>小闫购物</p>
    <ul>
    <input type="text" value="搜索想要的宝贝" />
    <input type="button" value="搜索" width="25px"/>
    </ul>
    <ul>
    <li><input name="text1" type="button" value="登陆" onclick="openning()"/></li>
    </ul>
    </div>
    <div id="menu">
    <ul>
     <li><a href="http:\www.baidu.com">首页</a></li>
     <li><a href="http:\www.baidu.com">居家特卖</a></li>
     <li><a href="http:\www.baidu.com">假日特卖</a></li>
     <li><a href="http:\www.baidu.com">海外广场</a></li>
     <li><a href="http:\www.baidu.com">学妹最爱</a></li>
     <li><a href="http:\www.baidu.com">I LOVE GO</a></li>
    </ul>
    </div>
    <div id="homePage1">
    <div id="homePage"><a href="http:\www.baidu.com"><form name="myForm">
    <img id="imgflash"/></form></a></div>
    </div>
    <div id="dlist">
     <dl>
      <dt><a href="http://www.szpt.edu.cn" target="_blank"><img src="2.jpg"/></a></dt>
      <dd><a href="http://www.szpt.edu.cn" target="_blank">女装卖场 </a></dd>
      <dd>298元</dd>
     </dl>
      <dl>
      <dt><a href="#"><img  src="3.jpg" /></a></dt>
      <dd><a href="#">数码用品</a></dd>
      <dd>298-80元</dd>
     </dl>
      <dl>
      <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356" target="_blank"><img src="4.jpg"/></a></dt>
      <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356">母婴用品</a></dd>
      <dd>298-80元</dd>
     </dl>
      <dl>
      <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="5.jpg"/></a></dt>
      <dd><a href="https://ai.taobao.com/pid=mm_99396806_46570087_81282000356"target="_blank">精品箱包</a></dd>
      <dd>298-80元</dd>
     </dl>
    </div>
    <div id="dlist1">
    <hr />
    <p>冬日暖装</p>
    </div>
    <div id="dlist2">
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="6.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">神奇女装</a></dd>
     <dd>298-80元</dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="7.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">魅力男装</a></dd>
     <dd>298-80元</dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="8.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">睡眠帮手</a></dd>
     <dd>298-80元</dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="9.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">暖心帮手</a></dd>
     <dd>298-80元</dd>
     </dl>
    </div>
    <div id="dlist4">
    <hr />
    <p>家电百货</p>
    </div>
    <div id="dlist3">
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="10.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">media家电</a></dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="12.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">唯美家具</a></dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="11.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">奥普照明</a></dd>
     </dl>
     <dl>
     <dt><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank"><img src="13.jpg"/></a></dt>
     <dd><a href="https://ai.taobao.com/ pid=mm_99396806_46570087_81282000356"  target="_blank">今日新品</a></dd>
     </dl>
         </div>
         <div id="buttom1">
         <div id="buttom">
     <ul>
     <li><a href="http:\www.baidu.com">关于我们</a></li>
     <li><a href="http:\www.baidu.com">about us</a></li>
     <li><a href="http:\www.baidu.com">品牌招商</a></li>
     <li><a href="http:\www.baidu.com">隐私条款</a></li>
     <li><em>小闫制作</em></li>
     </ul>
     <p>联系我们</p>
    </div>
    </div>
    </body>
    </html>
  • 相关阅读:
    如何理解css3 -webkit-animation-fill-mode属性值为both时的使用方法
    关于对canvas.beginPath()的理解
    [cf10E]Greedy Change
    [atAGC055B]ABC Supremacy
    [loj6734]图上的游戏
    [gym102412D]The Jump from Height of Self-importance to Height of IQ Level
    [Aizu1410]Draw in Straight Lines
    [Aizu2993]Invariant Tree
    [zoj3990]Tree Equation
    [hdu6326]Monster Hunter
  • 原文地址:https://www.cnblogs.com/studya/p/11443483.html
Copyright © 2011-2022 走看看