Submission #71474059


Source Code Expand

/* Code By WCM */
/*
Date:
大致思路:
复杂度:
期望得分:
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <vector>
#include <queue>
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define int long long

using namespace std;

inline int read();
void write(int);
void writeln(int);

signed main() {

//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);

	int n = read(), ans = 0;
	vector <int> a(n + 1), sum(n + 1, 0);
	for(int i = 1; i <= n; i++) a[i] = read(), sum[i] = sum[i - 1] + a[i];
	for(int l = 1; l <= n; l++)
		for(int r = l; r <= n; r++) {
			int S = sum[r] - sum[l - 1]; bool fl = 1;
			for(int i = l; i <= r; i++) if(S % a[i] == 0) { fl = 0; break; }
			if(fl) ans++;
		}
	printf("%lld\n", ans);
	
//	printf("\nThe time used: ");
//	printf("%.2lfs",(double)clock()/CLOCKS_PER_SEC);

	return 0;

}

inline int read() {
	int res = 0, f = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
	while(ch >= '0' && ch <= '9') res = (res << 1) + (res << 3) + (ch ^ 48), ch = getchar();
	return res * f;
}

void write(int x) {
	static int sta[35];
	int top = 0;
	do { sta[top++] = x % 10, x /= 10; } while(x);
	while(top) putchar(sta[--top] ^ 48);
}

void writeln(int x) {
	write(x);
	putchar('\n');
}


Submission Info

Submission Time
Task B - No-Divisible Range
User WZwangchongming
Language C++23 (GCC 15.2.0)
Score 200
Code Size 1493 Byte
Status AC
Exec Time 1 ms
Memory 3816 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 25
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3756 KiB
example_01.txt AC 1 ms 3588 KiB
hand_00.txt AC 1 ms 3736 KiB
hand_01.txt AC 1 ms 3756 KiB
hand_02.txt AC 1 ms 3704 KiB
hand_03.txt AC 1 ms 3816 KiB
hand_04.txt AC 1 ms 3636 KiB
hand_05.txt AC 1 ms 3636 KiB
hand_06.txt AC 1 ms 3592 KiB
hand_07.txt AC 1 ms 3652 KiB
random_00.txt AC 1 ms 3708 KiB
random_01.txt AC 1 ms 3816 KiB
random_02.txt AC 1 ms 3756 KiB
random_03.txt AC 1 ms 3636 KiB
random_04.txt AC 1 ms 3816 KiB
random_05.txt AC 1 ms 3704 KiB
random_06.txt AC 1 ms 3708 KiB
random_07.txt AC 1 ms 3752 KiB
random_08.txt AC 1 ms 3816 KiB
random_09.txt AC 1 ms 3736 KiB
random_10.txt AC 1 ms 3636 KiB
random_11.txt AC 1 ms 3636 KiB
random_12.txt AC 1 ms 3708 KiB
random_13.txt AC 1 ms 3752 KiB
random_14.txt AC 1 ms 3756 KiB