站外题(玄关)
  • 板块学术版
  • 楼主fhzm_kkk
  • 当前回复5
  • 已保存回复6
  • 发布时间2024/7/23 18:26
  • 上次更新2024/7/23 19:46:20
查看原帖
站外题(玄关)
1219419
fhzm_kkk楼主2024/7/23 18:26
Description
给出下面一段程序,每次运行输入一个n,输出结果。由于结果很大,请对1e9+7取模。

#include<bits/stdc++.h>
using namespace std;
int ans, n;
void A()
{
	ans++; 
}
void B(int j)
{
	for(int i = 0; i < j; i++)
		A();
}
void L(int x, int i)
{
	for(int j = i; j <= x; j++)
		B(j);
}
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
		L(n, i);
	cout << ans;
}
Format
Input
输入每行一个n(不超过1e10)。

Output
每行输出一个对1e9+7取模后的ans。.

哪位帮我想个思路(玄关)

2024/7/23 18:26
加载中...