提出 #67920424


ソースコード 拡げる

#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#include <iostream>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#pragma comment(linker, "/STACK:836777216")

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))
#define N 105

char s[N];

int main(void) {
	scanf("%s", &s);
	string a = (string)s;

	string ans = "";
	bool add = 1;

	REP(i, sz(a)) {
		if (a[i] == '.') {
			if (add) {
				ans += "o";
			}
			else {
				ans += '.';
			}
			add = 0;
		}
		else {
			ans += a[i];
			add = 1;
		}
	}

	printf("%s\n", ans.c_str());
}

提出情報

提出日時
問題 B - 1D Akari
ユーザ spiker
言語 C++ 20 (gcc 12.2)
得点 250
コード長 1794 Byte
結果 AC
実行時間 1 ms
メモリ 3812 KiB

コンパイルエラー

Main.cpp:22: warning: ignoring ‘#pragma comment ’ [-Wunknown-pragmas]
   22 | #pragma comment(linker, "/STACK:836777216")
      | 
Main.cpp: In function ‘int main()’:
Main.cpp:60:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[105]’ [-Wformat=]
   60 |         scanf("%s", &s);
      |                ~^   ~~
      |                 |   |
      |                 |   char (*)[105]
      |                 char*
Main.cpp:39:28: warning: unnecessary parentheses in declaration of ‘i’ [-Wparentheses]
   39 | #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
      |                            ^~~
Main.cpp:66:9: note: in expansion of macro ‘REP’
   66 |         REP(i, sz(a)) {
      |         ^~~
Main.cpp:39:28: note: remove parentheses
   39 | #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
      |                            ^~~
Main.cpp:66:9: note: in expansion of macro ‘REP’
   66 |         REP(i, sz(a)) {
      |         ^~~
Main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   60 |         scanf("%s", &s);
      |         ~~~~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 250 / 250
結果
AC × 4
AC × 21
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3696 KiB
00_sample_01.txt AC 1 ms 3524 KiB
00_sample_02.txt AC 1 ms 3708 KiB
00_sample_03.txt AC 1 ms 3812 KiB
01_handmade_00.txt AC 1 ms 3764 KiB
01_handmade_01.txt AC 1 ms 3560 KiB
01_handmade_02.txt AC 1 ms 3592 KiB
01_handmade_03.txt AC 1 ms 3716 KiB
01_handmade_04.txt AC 1 ms 3616 KiB
01_handmade_05.txt AC 1 ms 3776 KiB
01_handmade_06.txt AC 1 ms 3712 KiB
02_random_00.txt AC 1 ms 3640 KiB
02_random_01.txt AC 1 ms 3528 KiB
02_random_02.txt AC 1 ms 3544 KiB
02_random_03.txt AC 1 ms 3616 KiB
02_random_04.txt AC 1 ms 3652 KiB
02_random_05.txt AC 1 ms 3596 KiB
02_random_06.txt AC 1 ms 3524 KiB
02_random_07.txt AC 1 ms 3812 KiB
02_random_08.txt AC 1 ms 3704 KiB
02_random_09.txt AC 1 ms 3632 KiB