Submission #1412651
Source Code Expand
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <algorithm> #include <time.h> #include<cstdio> #include<vector> #include<functional> #include<math.h> using namespace std; long long a[51][51]; int main() { for (int i = 0; i<=50; i++) { a[i][0] = 1; a[i][i] = 1; } for (int i = 1; i <= 50; i++) { for (int j = 0; j <= i; j++) { a[i][j] = a[i - 1][j] + a[i - 1][j - 1]; } } int n, p; scanf("%d%d", &n, &p); int x; long long ou = 0, ji = 0; for (int i = 0; i < n; i++) { scanf("%d", &x); if (x % 2 == 0)ou++; else ji++; } long long res = 0; for (int i = p; i <= ji; i += 2) { res += a[ji][i] * pow(2ll, ou); } printf("%lld", res); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Biscuits |
User | Capricorn_fei |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 780 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:29:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &p); ^ ./Main.cpp:33:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &x); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt, sample4.txt |
All | sample1.txt, sample2.txt, sample3.txt, sample4.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 256 KB |
in2.txt | AC | 1 ms | 256 KB |
in3.txt | AC | 1 ms | 256 KB |
in4.txt | AC | 1 ms | 256 KB |
in5.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 1 ms | 256 KB |
in7.txt | AC | 1 ms | 256 KB |
in8.txt | AC | 1 ms | 256 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |
sample4.txt | AC | 1 ms | 256 KB |