跳到正文

个人记录

sss

#SUSPENDED#约 2 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 2e5;
int n, r, c;
string s;
map<int, map<int, bool> > mp;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> r >> c >> s;
	int x = 0, y = 0, len = s.size();
	mp[0][0] = true;
	for (int i = 0; i < len; i++) {
		if (s[i] == 'N') x++, r++;
		else if (s[i] == 'W') y++, c++;
		else if (s[i] == 'S') x--, r--;
		else if (s[i] == 'E') y--, c--;
		mp[x][y] = true;
		cout << mp[r][c];
	}
	return 0;
}
C++
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 998244353;
int m[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000};
int a[1000007], ans, cnt;
int sum[10000007];
signed main() {
	ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum[i] = (sum[i - 1] + a[i]) % mod;
	}
   	for (int j = 1; j <= n; j++) {
   		int len = to_string(a[j]).size();
		ans += ((sum[j - 1] * (long(pow(10, len)) % mod)) % mod + ((j - 1) * a[j]) % mod) % mod;
	}
	cout << ans % mod;
	return 0;
}
原文