1 条题解
-
0
C :
#include <stdio.h> #include <math.h> int main () { int n,m; scanf("%d%d",&n,&m); long long num=pow(n,n+1)-(n-1)*m; printf("%lld",num); return 0; }
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ int monkey,apple; long long int sum; cin>>monkey>>apple; sum=pow(monkey,monkey+1)-(monkey-1)*apple; cout<<sum<<endl; return 0; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); long ans=(long)Math.pow(n, n+1)-(n-1)*m; System.out.println(ans); } }
- 1
信息
- ID
- 2721
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者