zoukankan      html  css  js  c++  java
  • 最左/右边的数-hd1060/1061

    左边:

    http://acm.hdu.edu.cn/showproblem.php?pid=1060

     1 #include <iostream>
     2 #include <math.h>
     3 using namespace std;
     4 
     5 int main()
     6 {
     7     int n,m,d,i;
     8     double l;
     9     while(cin>>n)
    10 
    11     {
    12         for(i=1;i<=n;i++)
    13         {
    14             cin>>m;
    15             l=m*log10(m)-(long long)(m*log10(m));
    16             d=(int)pow(10,l);
    17             cout<<d<<endl;
    18         }
    19     }
    20     return 0;
    21 }
    View Code
     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 #include <math.h>
     4 int main()
     5 {
     6     int m,i,n;
     7     double l,d;
     8     while(~scanf("%d",&m))
     9     {
    10         for(i=1;i<=m;i++)
    11         {
    12             scanf("%d",&n);
    13             l=n*log10(n)-(long long)(n*log10(n));
    14             d=pow(10,l);
    15             printf("%d
    ",(int)d);
    16         }
    17     }
    18     return 0;
    19 }
    View Code

    右边:

    http://acm.hdu.edu.cn/showproblem.php?pid=1061

     1 #include <iostream>
     2 
     3 using namespace std;
     4 
     5 int main()
     6 {
     7     int n,m,i,j,k,data[10][4]={{0,0,0,0},{1,1,1,1},{6,2,4,8},{1,3,9,7},{6,4,6,4},{5,5,5,5},{6,6,6,6},{1,7,9,3},{6,8,4,2},{1,9,1,9}};
     8     while(cin>>n)
     9     {
    10         for(i=1;i<=n;i++)
    11         {
    12             cin>>m;
    13             k=m%10;
    14             j=m%4;
    15             cout<<data[k][j]<<endl;
    16         }
    17     }
    18     return 0;
    19 }
    View Code
     1  
     2 Online Judge    Online Exercise    Online Teaching    Online Contests    Exercise Author
     3 F.A.Q
     4 Hand In Hand
     5 Online Acmers    
     6 Forum | Discuss
     7 Statistical Charts
     8 Problem Archive
     9 Realtime Judge Status
    10 Authors Ranklist
    11 
    12  Search
    13      C/C++/Java Exams     
    14 ACM Steps
    15 Go to Job
    16 Contest LiveCast
    17 ICPC@China
    18 Best Coder beta
    19 VIP | STD Contests
    20 Virtual Contests 
    21     DIY | Web-DIY beta
    22 Recent Contests
    23 Author acmfighting
    24 Mail Mail 0(0)
    25 Control Panel Control Panel 
    26 Sign Out Sign Out
    27 Hot~~招聘——亚信科技,巴卡斯(杭州),壹晨仟阳(杭州),英雄互娱(杭州) 
    28 (包括2016级新生)除了校赛,还有什么途径可以申请加入ACM校队? 
    29 View Code
    30 
    31 Problem : 1061 ( Rightmost Digit )     Judge Status : Accepted
    32 RunId : 16073921    Language : C    Author : wangyawei
    33 Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
    34 #include <stdio.h>
    35 #include <stdlib.h>
    36 #include<string.h>
    37 int main()
    38 {
    39      int data[10][4]={{0},{1},{6,2,4,8},{1,3,9,7},{6,4},{5},{6},{1,7,9,3},{6,8,4,2},{1,9}};
    40      int n,i,t,num;
    41      while(~scanf("%d",&num))
    42      {
    43          for(i=1;i<=num;i++)
    44          {
    45              scanf("%d",&n);
    46          t=n%10;
    47          if(t==0||t==1||t==5||t==6)
    48          printf("%d
    ",t);
    49          else if(t==4||t==9)
    50          printf("%d
    ",data[t][n%2]);
    51          else if(t==2||t==3||t==7||t==8)
    52          printf("%d
    ",data[t][n%4]);
    53          }
    54      }
    55     return 0;
    56 }
    View Code
  • 相关阅读:
    markdown keynote
    pyecharts
    运行成功
    python发邮件3
    python发邮件2
    python发邮件1
    python发邮件
    python中的编码声明
    auther tonyxiao
    111
  • 原文地址:https://www.cnblogs.com/wang-ya-wei/p/5444681.html
Copyright © 2011-2022 走看看