跳到正文

个人记录

如何造数据

Hty111约 3 分钟
原文
文章信息与版本

文章信息

发布
2023年12月30日
收录
2026年2月5日
更新
2026年10月28日
篇幅
约 3 分钟

版本

  1. v2当前
  2. v1

.in

C++
#include<bits/stdc++.h>
using namespace std;
char order[110];
/*————————————————*/
const char file_name[]="ABC";//filename为题目名
const int Data_Case=21;
const int type[Data_Case]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//这里是分段数据
long long Random(){//随机数(不可改)
	return ((long long)rand()<<30LL)|((long long)rand()<<45LL)|((rand()<<15)|rand());
}
int low = 100000000000;//数据上限
void Maker(long long k)
{
	int n, m = 0, t = 0;
    /*
   	这里按格式造数据
    */
}
int main(){
    srand(time(0));
    for(int i=1;i<=20;i++){//i为几组数据
        sprintf(order,"%s%d.in",file_name,i);
        freopen(order,"w",stdout);
        Maker(type[i]);
    }
    return 0;
}

.out

C++
#include <bits/stdc++.h>
#define N 5005
#define lll long long
using namespace std;
lll ans, n;
char order[25], file_name[]="ABC";//filename同上
void wrk(){//这里是正解
	ans = 0;
    scanf("%lld", &n);
    for (int a = 1; a * a * a <= n; a++) {
        int k = n / a;
        for (int b = a; b * b <= k; b++) {
            int c = n / a / b;
            if (c >= b) {
                ans += c - b + 1;
            }
        }
    }
    printf("%lld", ans);
}

int main() {
	for(int i=1;i<=20;i++){//change***********此处同上
		sprintf(order,"%s%d.in",file_name,i);
	    freopen(order,"r",stdin);
	    sprintf(order,"%s%d.out",file_name,i);
	    freopen(order,"w",stdout);//
	    wrk();
	}
    return 0;
}
原文