zoukankan      html  css  js  c++  java
  • B

     1 //c++
     2 #include <cstdio>
     3 #include <cstdlib>
     4 #include <cstring>
     5 #include <iostream>
     6 using namespace std;
     7  
     8 string n;
     9 int a[101];
    10  
    11 int main()
    12 {
    13     while (cin>>n)
    14     {
    15         memset(a,0,sizeof(a));
    16         a[0]=n.size();
    17         for (int i=1;i<=a[0];i++)
    18             a[i]=n[a[0]-i]-'0';
    19         for (int j=1;j<=a[0];j++)
    20             a[j]=a[j]*6;
    21         for (int j=1;j<=a[0];j++)
    22         {
    23             a[j+1]+=a[j]/10;
    24             a[j]=a[j]%10;
    25         }
    26         while (a[a[0]+1]>0)
    27         {
    28             a[0]++;
    29             a[a[0]+1]+=a[a[0]]/10;
    30             a[a[0]]%=10;
    31         }
    32         a[1]-=3;
    33         int k=1;
    34         while (a[k]<0 && k<=a[0])
    35         {
    36             a[k+1]-=1;
    37             a[k]+=10;
    38             k++;
    39         }
    40         while (a[a[0]]<=0)
    41             a[0]--;
    42         for (int i=a[0];i>0;i--)
    43             printf("%d",a[i]);
    44         printf(" ");
    45     }
    46     return 0;
    47 }
    48 
    49 
    50 // java
    51 import java.io.*;  
    52 import java.math.BigInteger;  
    53 import java.util.*;  
    54  
    55 public class Main  
    56 {  
    57     public static void main(String args[])  
    58     {  
    59         Scanner cin = new Scanner(System.in);     
    60         while(cin.hasNext())  
    61         {  
    62             BigInteger a = cin.nextBigInteger();
    63             BigInteger b=BigInteger.valueOf(2);
    64             a=a.multiply(b);
    65             b=BigInteger.valueOf(1);
    66             a=a.subtract(b);
    67             b=BigInteger.valueOf(3);
    68             a=a.multiply(b);
    69             System.out.println(a);
    70         }  
    71     }  
    72 }
    View Code
  • 相关阅读:
    CListCtrl基本用法
    学习c++:获得函数私有变量
    vc 学习笔记 之工程
    怎样用c/c++编程连接mysql数据库?
    几天的总结,CEdit,CListctl.......
    c++ const成员函数
    PreparedStatement是如何大幅度提高性能的 (转)
    __declspec(dllexport)与.def文件
    让我懂得 多态性 的网友的帖子
    解读工程 之困惑之处
  • 原文地址:https://www.cnblogs.com/acvc/p/4419842.html
Copyright © 2011-2022 走看看