Submission #36223645


Source Code Expand

#include <bits/stdc++.h>
const int MAXN = 1e5 + 10;
namespace trash_without_mode{
#define foe(i, now) for (int i = head[now]; ~i; i = edg[i].edg)
#define fo(i, g1, g2) for (int i = (g1), __Endi__ = (g2); i <= __Endi__; ++i)
#define fd(i, g1, g2) for (int i = (g1), __Endi__ = (g2); i >= __Endi__; --i)
#define go(v,now)     for (auto &v:edg[now])
#define mem(g1, g2) memset((g1), g2, sizeof((g1)))
#define lowbit(now) ((now) & (-now))
#define lson ((now) << 1)
#define mid ((l + r) / 2)
#define rson (lson | 1)
#define ll long long
#define pb push_back
#define mp(g1, g2) make_pair((g1), (g2))
#define PII pair<int, int>
#define pow2(g2) (1ll << (g2))
#define II inline void
#define INF (0x3f3f3f3f)
#define ps push
#define lsond lson, l, mid
#define rsond rson, mid + 1, r

namespace Fread
{
	const int SIZE = (1 << 26) + 1; // namespace Fread
	char buf[SIZE], *S, *T;
}
namespace Fwrite
{
	const int SIZE = (1 << 26) + 1; // namespace Fwrite
	char buf[SIZE], *S = buf, *T = buf + SIZE;
	inline void flush()
	{
		fwrite(buf, 1, S - buf, stdout), S = buf;
	}
	struct NTR
	{
		~NTR()
		{
			flush();
		}
	} ztr;
}

#ifdef ONLINE_JUDGE
#define getchar() (Fread::S == Fread::T && (Fread::T = (Fread::S = Fread::buf) + fread(Fread::buf, 1, 1 << 23, stdin), Fread::S == Fread::T) ? '\n' : *Fread::S++)
#define putchar(c) (*Fwrite::S++ = c, (Fwrite::S != Fwrite::T) ? 0 : (Fwrite::flush(), 0))
#endif
namespace Fastio
{
	struct Reader
	{
		template <typename T>
		inline Reader &operator>>(T &now)
		{
			static char c;
			static short f;
			c = getchar(), f = 1;

			while (!isdigit(c))
			{
				c ^ '-' ? c = getchar() : (f = -1, c = getchar());
			}
			now = 0;

			while (isdigit(c))
			{
				now = now * 10 + (c ^ '0'), c = getchar();
			}
			return now *= f, *this;
		}
		inline Reader &operator>>(char &c)
		{
			c = getchar();

			while (c == '\n' || c == ' ')
				c = getchar();

			return *this;
		}
		inline Reader &operator>>(char *str)
		{
			static int len = 0;
			len = 0;
			static char c;
			c = getchar();

			while (c == '\n' || c == ' ')
				c = getchar();

			while (c ^ '\n' && c ^ ' ')
			{
				str[len++] = c, c = getchar();
			}
			return str[len] = '\0', *this;
		}
		Reader() {}

	} cin;
	const char endl = '\n';
	struct Writer
	{
		template <typename T>
		inline Writer &operator<<(T now)
		{
			static int cnt = 0;
			now ? (now < 0 ? putchar('-'), now = -now, cnt = 0 : cnt = 0) : (putchar('0'), cnt = 0);
			static int sta[45];

			while (now)
			{
				sta[++cnt] = now % 10, now /= 10;
			}
			while (cnt)
			{
				putchar(sta[cnt] | 48), --cnt;
			}
			return *this;
		}
		inline Writer &operator<<(const char c)
		{
			return putchar(c), *this;
		}
		inline Writer &operator<<(const char *str)
		{
			static int cur = 0;
			cur = 0;

			while (str[cur])
				putchar(str[cur++]);

			return *this;
		}
		inline Writer &operator<<(char *str)
		{
			static int cur = 0;
			cur = 0;

			while (str[cur])
				putchar(str[cur++]);

			return *this;
		}
		Writer() {}

	} cout;
}

#define cin Fastio ::cin
#define cout Fastio ::cout
#define endl Fastio ::endl

using namespace std;
}
using namespace trash_without_mode;
char s[MAXN];
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("txt.in", "r", stdin);
	freopen("txt.out", "w", stdout);
#endif
	cin >> (s+1);
	int ans = -1;
	int n = strlen(s+1);
	fo (i,1,n) if (s[i]=='a') ans = i;
	cout<<ans;
	return 0;
}

Submission Info

Submission Time
Task A - Rightmost
User lby_my_superman
Language C++ (GCC 9.2.1)
Score 100
Code Size 3546 Byte
Status AC
Exec Time 5 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 14
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt
Case Name Status Exec Time Memory
example_00.txt AC 5 ms 3348 KiB
example_01.txt AC 2 ms 3388 KiB
example_02.txt AC 2 ms 3492 KiB
test_00.txt AC 2 ms 3540 KiB
test_01.txt AC 1 ms 3544 KiB
test_02.txt AC 2 ms 3504 KiB
test_03.txt AC 2 ms 3604 KiB
test_04.txt AC 2 ms 3608 KiB
test_05.txt AC 2 ms 3604 KiB
test_06.txt AC 1 ms 3536 KiB
test_07.txt AC 2 ms 3492 KiB
test_08.txt AC 2 ms 3544 KiB
test_09.txt AC 2 ms 3408 KiB
test_10.txt AC 2 ms 3440 KiB