|Tyvj|NOIP2013|模拟|P2772 表达式求值
来源:互联网 发布:手游java服务器端源码 编辑:程序博客网 时间:2024/05/01 15:29
http://tyvj.cn/p/2772
此题由于我不喜欢用栈写表达式(分明是不会),所以用个链表乱搞AC了。。
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int sz[100005];//数字 int bh[100005];//标号,链表储存 int s_n = 0;char fh[100005];//符号 int f_n = 0;char lastch=' ',ch;int main () { //freopen("123.in","r", stdin);memset(sz, 0, sizeof(sz));int i = 0;ch = getchar();while(ch!='\n'){if (ch=='+'||ch=='*') fh[++f_n] = ch;if (ch>='0'&&ch<='9'){if(lastch>='0'&&lastch<='9'){sz[s_n] = (sz[s_n] * 10 + ch - '0') % 10000;} else sz[++s_n] = ch - '0';}lastch = ch;ch = getchar();} for (int i=1;i<=s_n;i++) bh[i] = i+1;bh[s_n] = 10000000;for (int i=1;i<=f_n;i++){if(fh[i]=='*'){sz[bh[i]] = sz[i] * sz[bh[i]] % 10000;sz[i] = 765428;}}int tot = 0;for (int i=1;i<=s_n;i=bh[i]){if (sz[i]!=765428)tot = (tot+sz[i])%10000;}printf("%d\n", tot);return 0;}
0 0
- |Tyvj|NOIP2013|模拟|P2772 表达式求值
- [NOIP2013]表达式求值 T2 模拟
- NOIP2013 表达式求值
- [NOIP2013]表达式求值 T2 题解
- noip2013 表达式求值 (表达式求值加法与乘法)
- NOIP2013普及组 T2 表达式求值
- NOIP2013普及组 T2 表达式求值
- 表达式求值 noip2013普及组t2
- 1180: [NOIP2013普及组]表达式求值
- 栈模拟表达式求值
- 【BSOJ1724】【bzoj3032】TYVJ P1924 【NOIP2013模拟】七夕祭
- 【NOIP2013普及组P2】表达式求值(NKOJ2500)题解
- NYOJ 305-表达式求值【模拟】
- nyoj1272~表达式求值(stack+模拟)
- NYOJ-305 表达式求值(模拟)
- 表达式求值——栈模拟
- nyoj 35 表达式求值<模拟+栈>
- 【NOIP2013模拟】七夕祭
- SASS/SCSS 使用指南
- 浏览器打开android app
- java中使用正则校验
- NYOJ 32 组合数
- Android 开源框架Universal-Image-Loader完全解析(一)--- 基本介绍及使用
- |Tyvj|NOIP2013|模拟|P2772 表达式求值
- adb devices连接提示 Android offline或unauthorized的解决办法
- App系列------如何把asset目录下文件copy到机台中
- LeetCode | Regular Expression Matching
- php mysqli的使用方法
- iOS流布局UICollectionView系列二——UICollectionView的代理方法
- qt 多线程用法
- Retrofit2总结一
- Android 开源框架Universal-Image-Loader完全解析(一)--- 基本介绍及使用