提出 #11051672
ソースコード 拡げる
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
//My i/o stream
struct fastio
{
char s[100000];
int it, len;
fastio() {it=len=0;}
inline char get()
{
if (it<len) return s[it++]; it=0;
len=fread(s, 1, 100000, stdin);
if (len==0) return EOF; else return s[it++];
}
bool notend()
{
char c=get();
while (c==' '||c=='\n') c=get();
if (it>0) it--;
return c!=EOF;
}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
ll r=0; bool ng=0; char c; c=_buff.get();
while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
if (c=='-') ng=1, c=_buff.get();
while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
if (x<0) putchar('-'), x=-x;
register short a[20]={}, sz=0;
while (x) a[sz++]=x%10, x/=10;
if(sz==0) putchar('0');
for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}
const int mod = 1e9+7;
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
int n;
char s[1000111];
bool calc(char c)
{
bool ret = 0;
for (int i=0; i<n; i++)
{
if (s[i]==c&&((n-1)&i)==i)
{
ret ^= 1;
}
}
return ret;
}
int main()
{
scanf("%d", &n);
scanf("%s", s);
bool f = false;
for (int i=0; i<n; i++)
{
f |= s[i]=='2';
}
if (f)
{
cout<<calc('2')<<endl;
}
else
{
cout<<calc('3')*2<<endl;
}
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
B - 123 Triangle |
| ユーザ |
fizzydavid |
| 言語 |
C++14 (GCC 5.4.1) |
| 得点 |
700 |
| コード長 |
1949 Byte |
| 結果 |
AC |
| 実行時間 |
9 ms |
| メモリ |
1280 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:77:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:78:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", s);
^
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
700 / 700 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
0_000.txt, 0_001.txt |
| All |
0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt, 1_036.txt, 1_037.txt, 1_038.txt, 1_039.txt, 1_040.txt, 1_041.txt, 1_042.txt, 1_043.txt, 1_044.txt, 1_045.txt, 1_046.txt, 1_047.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 0_000.txt |
AC |
1 ms |
256 KiB |
| 0_001.txt |
AC |
1 ms |
256 KiB |
| 1_002.txt |
AC |
1 ms |
256 KiB |
| 1_003.txt |
AC |
1 ms |
256 KiB |
| 1_004.txt |
AC |
1 ms |
256 KiB |
| 1_005.txt |
AC |
1 ms |
256 KiB |
| 1_006.txt |
AC |
1 ms |
256 KiB |
| 1_007.txt |
AC |
1 ms |
256 KiB |
| 1_008.txt |
AC |
9 ms |
1280 KiB |
| 1_009.txt |
AC |
9 ms |
1280 KiB |
| 1_010.txt |
AC |
9 ms |
1280 KiB |
| 1_011.txt |
AC |
6 ms |
1280 KiB |
| 1_012.txt |
AC |
8 ms |
1280 KiB |
| 1_013.txt |
AC |
8 ms |
1280 KiB |
| 1_014.txt |
AC |
8 ms |
1280 KiB |
| 1_015.txt |
AC |
6 ms |
1280 KiB |
| 1_016.txt |
AC |
5 ms |
768 KiB |
| 1_017.txt |
AC |
5 ms |
768 KiB |
| 1_018.txt |
AC |
5 ms |
768 KiB |
| 1_019.txt |
AC |
3 ms |
768 KiB |
| 1_020.txt |
AC |
5 ms |
768 KiB |
| 1_021.txt |
AC |
5 ms |
768 KiB |
| 1_022.txt |
AC |
5 ms |
768 KiB |
| 1_023.txt |
AC |
4 ms |
768 KiB |
| 1_024.txt |
AC |
5 ms |
768 KiB |
| 1_025.txt |
AC |
5 ms |
768 KiB |
| 1_026.txt |
AC |
5 ms |
768 KiB |
| 1_027.txt |
AC |
4 ms |
768 KiB |
| 1_028.txt |
AC |
5 ms |
768 KiB |
| 1_029.txt |
AC |
5 ms |
768 KiB |
| 1_030.txt |
AC |
5 ms |
768 KiB |
| 1_031.txt |
AC |
3 ms |
768 KiB |
| 1_032.txt |
AC |
3 ms |
512 KiB |
| 1_033.txt |
AC |
3 ms |
512 KiB |
| 1_034.txt |
AC |
3 ms |
512 KiB |
| 1_035.txt |
AC |
2 ms |
512 KiB |
| 1_036.txt |
AC |
3 ms |
512 KiB |
| 1_037.txt |
AC |
3 ms |
512 KiB |
| 1_038.txt |
AC |
3 ms |
512 KiB |
| 1_039.txt |
AC |
2 ms |
512 KiB |
| 1_040.txt |
AC |
8 ms |
1280 KiB |
| 1_041.txt |
AC |
8 ms |
1280 KiB |
| 1_042.txt |
AC |
5 ms |
768 KiB |
| 1_043.txt |
AC |
5 ms |
768 KiB |
| 1_044.txt |
AC |
5 ms |
768 KiB |
| 1_045.txt |
AC |
5 ms |
768 KiB |
| 1_046.txt |
AC |
8 ms |
1280 KiB |
| 1_047.txt |
AC |
8 ms |
1280 KiB |