【北大oj】

来源:互联网 发布:java web框架有哪些 编辑:程序博客网 时间:2024/04/30 01:19

1000

#include<iostream>
using namespace std;


int main()
{
  int a, b;
  cin >> a;
  cin >> b;
  cout << (a+b) << endl;
  return 0;
}


T1001 

#include<iostream>
#include<stdlib.h>
using namespace std;


void main()
{
  double R;
  int  n;
  double product = 1;
  cin >> R >> n;


  while(n)
  {
if(n&1)
{
product *= R;
}
R *= R;
n >>= 1;
  }


  if ((int)product == product)
 printf("%u", (int)product);
  else
 printf("%f", product);


  system("pause");
  
}

但是visualC++中运行,结果精度不够

0 0
原创粉丝点击