标签:ch 记录 int char p1 做题 平衡 include buf
板子就不说了。
P2786 英语1(eng1)- 英语作文
红黑树 map 随便做,用一个 map 存下字符串对应的值,一个字符一个字符读入,然后判断, 如果不是数字并且不是字母,说明空格或者符号,处理答案。
/**
* author: TLE_Automation
* creater: 2022.9.7
**/
#include<cmath>
#include<queue>
#include<cstdio>
#include<bitset>
#include<cstring>
#include<iostream>
#include<algorithm>
#define gc getchar
using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
const int mod = 998244353;
const ll inf = 0x3f3f3f3f3f3f3f3f;
#define debug cout << "i ak ioi" << "\n"
inline void print(int x) {if (x < 0) putchar('-'), x = -x; if(x > 9) print(x / 10); putchar(x % 10 + '0');}
inline char readchar() {static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;}
inline int read() { int res = 0, f = 0; char ch = gc();for (; !isdigit(ch); ch = gc()) f |= (ch == '-'); for (; isdigit(ch); ch = gc()) res = (res << 1) + (res << 3) + (ch ^ '0'); return f ? -res : res;}
#include <unordered_map>
int n, p, ans;
char ch; string t;
unordered_map <string, int> mp;
signed main()
{
n = read(), p = read();
for(int i = 1; i <= n; i++) {
string s; cin >> s; mp[s] = read();
}
while((ch = getchar()) && ch != EOF) {
if(!isdigit(ch) && !isalpha(ch)) ans = (ans + mp[t]) % p, t = "";
else t += ch;
}
printf("%d\n", ans);
return (0 - 0);
}
标签:ch,记录,int,char,p1,做题,平衡,include,buf 来源: https://www.cnblogs.com/tttttttle/p/16667986.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。