---
# System prepended metadata

title: APCS 2025.01 by richardlaiis

---

# APCS 2025.01 by richardlaiis
Sorry, but I prefered programming in C, and this editorial is not finished yet. QwQ
題目連結請點題號 =w=
[Solution by banyewu](https://hackmd.io/@bangyewu/rJlvXNP81g?utm_source=preview-mode&utm_medium=rec)
## [Q1](https://zerojudge.tw/ShowProblem?problemid=q181)
你應該有做出來。
```cpp!
#include <stdio.h>
int main() {
	int a, b, n, sum = 0;
	scanf("%d%d%d", &a, &b, &n);
	int cyclet = a+b;
	for(int i = 0; i < n; i++) {
		int t;
		scanf("%d", &t);
		if(t%cyclet >= a) sum += cyclet-t%cyclet;
	}
	printf("%d\n", sum);
}
```
## [Q2](https://zerojudge.tw/ShowProblem?problemid=q182)
要開一個字串/字元陣列去紀錄**當前**的字串，剩餘的維護相當簡單
```cpp!
#include <stdio.h>
#include <string.h>
int main() {
	char input[105];
	scanf("%s", input);
	int len = strlen(input);
	int k;
	scanf("%d", &k);
	char ans[105];
	char prev[105];
	strcpy(prev, input);
	while(k--) {
		int op;
		scanf("%d", &op);
		if(op == 0) {
			for(int i = 0; i <= len-2; i+=2) {
				ans[i] = prev[i+1];
				ans[i+1] = prev[i];
			}
		}else if(op == 1) {
			for(int i = 0; i <= len-2; i+=2) {
				if(prev[i]-prev[i+1] > 0) {
					ans[i] = prev[i+1];
					ans[i+1] = prev[i];
				}else {
					ans[i] = prev[i];
					ans[i+1] = prev[i+1];
				}
			}
		}else {
			int j = 0;
			for(int i = 0; i < len/2; i++) {
				ans[j++] = prev[i];
				ans[j++] = prev[i+len/2];
			}
		}
		ans[len] = '\0';
		strcpy(prev, ans);
	}
	printf("%s\n", ans);
}
```
### [Q3](https://zerojudge.tw/ShowProblem?problemid=q183)
#### 30% subtask $(n\le6)$


### [Q4](https://zerojudge.tw/ShowProblem?problemid=q184)