提出 #71483449
ソースコード 拡げる
#include <bits/stdc++.h>
#define LOCAL
#define re register
// #define int long long
namespace IO{
#define isdigit(ch) (ch >= '0' && ch <= '9')
constexpr int fix = 6, SIZE = 1 << 20;
namespace Read{
#ifndef LOCAL
char buf[SIZE], *_now = buf, *_end = buf;
inline char getchar(){ if(_now == _end){ _now = _end = buf; _end += fread(buf, 1, SIZE, stdin); if(_now == _end) return EOF; } return *(_now++); }
#endif
template <typename T>
inline void read(T &w){ w = 0; short f = 1; char ch = getchar(); while(!isdigit(ch)){ if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)) w = (w << 1) + (w << 3) + (ch ^ 48), ch = getchar(); w *= f; }
inline void read(char &c){ char tmp = getchar(); while(tmp == ' ' || tmp == '\n') tmp = getchar(); c = tmp; }
#define check(ch) (ch == ' ' || ch == '\n')
inline void read(char *s){ char ch = getchar(); while(check(ch) && ch != EOF) ch = getchar(); int len = 0; while(!check(ch) && ch != EOF) s[len++] = ch, ch = getchar(); s[len] = '\0'; }
inline void read(std::string &s){ s.clear(); char ch = getchar(); while(check(ch) && ch != EOF) ch = getchar(); while(!check(ch) && ch != EOF) s.push_back(ch), ch = getchar(); }
inline void read(double &w){
w = 0; short f = 1; char ch = getchar();
while(!isdigit(ch)){ if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar();
if(ch == '.'){ ch = getchar(); int len = 0; while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar(), ++len; while(len) w /= 10, --len; } w *= f;
}
inline void read(float &w){
w = 0; short f = 1; char ch = getchar();
while(!isdigit(ch)){ if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar();
if(ch == '.'){ ch = getchar(); int len = 0; while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar(), ++len; while(len) w /= 10, --len; } w *= f;
}
inline void read(long double &w){
w = 0; short f = 1; char ch = getchar();
while(!isdigit(ch)){ if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar();
if(ch == '.'){ ch = getchar(); int len = 0; while(isdigit(ch)) w = w * 10 + (ch ^ 48), ch = getchar(), ++len; while(len) w /= 10, --len; } w *= f;
}
#undef check
class qistream{ public: template <typename T> inline qistream &operator >> (T &a){ read(a); return *this; } inline qistream &operator >> (char *s){ read(s); return *this; } } cin;
};
namespace Write{
#ifndef LOCAL
char buf[SIZE], *p = buf;
template <typename T> struct pres{ T num; int len; };
template <typename T> inline pres <T> make_lf(T num, int len){ pres <T> ret; ret.num = num, ret.len = len; return ret; } inline void flush(){ fwrite(buf, 1, p - buf, stdout); p = buf; } inline void putchar(char ch){ if(p == buf + SIZE) flush(); *p = ch; ++p; } class Flush{ public: ~Flush(){ flush(); }; } _;
#endif
template <typename T> inline void write(T x){
char st[50]; int len = 0;
if(x < 0) putchar('-'), x = -x;
do{ st[++len] = x % 10 + '0'; x /= 10; } while(x); while(len) putchar(st[len--]);
} inline void write(char c){ putchar(c); } inline void write(const char *s){ int siz = strlen(s); for(int i = 0; i < siz; ++i) putchar(s[i]); } inline void write(char *s){ int siz = strlen(s); for(int i = 0; i < siz; ++i) putchar(s[i]); } inline void write(std::string &s){ int siz = s.size(); for(int i = 0; i < siz; ++i) putchar(s[i]); } inline void write(double x, int len = fix){
double tmp = x; if(x < 0) putchar('-'), x = -x, tmp = -tmp; double y = 5 * powl(10, -len - 1); x += y, tmp += y; int lennow = 0; char st[50];
if(x < 1) putchar('0');
else for(; x >= 1; x /= 10) st[++lennow] = floor(x) - floor(x / 10) * 10 + '0';
while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
} inline void write(float x, int len = fix){
float tmp = x; if(x < 0) putchar('-'), x = -x, tmp = -tmp; float y = 5 * powl(10, -len - 1); x += y, tmp += y; int lennow = 0; char st[50];
if(x < 1) putchar('0');
else for(; x >= 1; x /= 10) st[++lennow] = floor(x) - floor(x / 10) * 10 + '0';
while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
} inline void write(long double x, int len = fix){
long double tmp = x; if(x < 0) putchar('-'), x = -x, tmp = -tmp; long double y = 5 * powl(10, -len - 1); x += y, tmp += y; int lennow = 0; char st[50];
if(x < 1) putchar('0');
else for(; x >= 1; x /= 10) st[++lennow] = floor(x) - floor(x / 10) * 10 + '0';
while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
}
class qostream{
public: template <typename T> inline qostream &operator << (T x){ write(x); return *this; } inline qostream &operator << (const char *s){ write(s); return *this; }
#ifndef LOCAL
template <typename T> inline qostream &operator << (const pres <T> x){ write(x.num, x.len); return *this; }
#endif
} cout;
};
using namespace Read; using namespace Write;
}; using namespace IO;
constexpr int N = 1e5 + 5;
int a[N], sum[N];
int main(){
int n, ans = 0;
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i], sum[i] = sum[i - 1] + a[i];
for(int i = 1; i <= n; ++i){
for(int j = i + 1; j <= n; ++j){
int s = sum[j] - sum[i - 1];
int flag = 1;
for(int k = i; k <= j; ++k){
if(s % a[k] == 0){
flag = 0;
break;
}
}
ans += flag;
}
}
cout << ans << '\n';
return 0;
}
提出情報
コンパイルエラー
./Main.cpp: In function 'void IO::Write::write(double, int)':
./Main.cpp:52:13: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
52 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~
./Main.cpp:52:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
52 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~~~
./Main.cpp: In function 'void IO::Write::write(float, int)':
./Main.cpp:57:13: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
57 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~
./Main.cpp:57:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
57 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~~~
./Main.cpp: In function 'void IO::Write::write(long double, int)':
./Main.cpp:62:13: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
62 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~
./Main.cpp:62:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
62 | while(lennow) putchar(st[lennow--]); putchar('.'); for(tmp *= 10; len; --len, tmp *= 10) putchar(floor(tmp) - floor(tmp / 10) * 10 + '0');
| ^~~~~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
200 / 200 |
| 結果 |
|
|
| セット名 |
テストケース |
| 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 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| example_00.txt |
AC |
1 ms |
3628 KiB |
| example_01.txt |
AC |
1 ms |
3312 KiB |
| hand_00.txt |
AC |
1 ms |
3468 KiB |
| hand_01.txt |
AC |
1 ms |
3428 KiB |
| hand_02.txt |
AC |
1 ms |
3380 KiB |
| hand_03.txt |
AC |
1 ms |
3420 KiB |
| hand_04.txt |
AC |
1 ms |
3464 KiB |
| hand_05.txt |
AC |
1 ms |
3488 KiB |
| hand_06.txt |
AC |
1 ms |
3540 KiB |
| hand_07.txt |
AC |
1 ms |
3488 KiB |
| random_00.txt |
AC |
1 ms |
3572 KiB |
| random_01.txt |
AC |
1 ms |
3540 KiB |
| random_02.txt |
AC |
1 ms |
3444 KiB |
| random_03.txt |
AC |
1 ms |
3632 KiB |
| random_04.txt |
AC |
1 ms |
3428 KiB |
| random_05.txt |
AC |
1 ms |
3552 KiB |
| random_06.txt |
AC |
1 ms |
3444 KiB |
| random_07.txt |
AC |
1 ms |
3464 KiB |
| random_08.txt |
AC |
1 ms |
3428 KiB |
| random_09.txt |
AC |
1 ms |
3572 KiB |
| random_10.txt |
AC |
1 ms |
3540 KiB |
| random_11.txt |
AC |
1 ms |
3536 KiB |
| random_12.txt |
AC |
1 ms |
3464 KiB |
| random_13.txt |
AC |
1 ms |
3536 KiB |
| random_14.txt |
AC |
1 ms |
3536 KiB |