7.29 第四场 Calculus
2021/8/2 23:07:15
本文主要是介绍7.29 第四场 Calculus,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Calculus
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 398 Accepted Submission(s): 214
Problem Description
This summer, ZXyang became so tired when doing the problems of Multi-University contests. So he decided to attend the Unified National Graduate Entrance Examination. This day, he sees a problem of series.
Let S(x) be a function with x as the independent variable. S(x) can be represented by the formula as follow.
f(x)=∑i=1nfi(x)
S(x)=∑j=1xf(j)
fi(x) is a function with x as the independent variable. Furthermore. fi(x) belongs to the function set F.
F={C,Cx,Csinx,Ccosx,Csinx,Ccosx,Cx,Cx}
C is a constant integer ranging from 0 to 109.
ZXyang wonders if S(x) is convergent. S(x) is convergent if and only if limx→∞S(x)=c, where c is a constant.
Input
The first line of input contains a single integer t (1≤t≤104) — the number of test cases.
The first and the only line of each test case contains a single string s (1≤|s|≤100), indicating the formula of f(x). Fraction is presented as a/b. Cx is presented as C^x. It’s guaranteed that the constant C won’t be left out when C=1. f(x) consists of functions from F connected with +.
Output
For each test case, print YES in one line if S(x) is a convergent sequence, or print NO in one line if not.
Sample Input
2 1sinx+0cosx+3x+6/sinx 0
Sample Output
NO YES
大概题意
判断所给函数是否收敛
思路
数学问题。。。直接判断字符串里有没有0即可
代码
#include<iostream> using namespace std; int t; string s; int main() { cin >> t; getchar(); while (t--) { getline(cin, s); bool flag = false; for (int i = 0; i < s.length(); ++i) { if (s[i] > '0' && s[i] <= '9') { cout << "NO\n"; flag = true; break; } } if (!flag) cout << "YES\n"; } return 0; }
这篇关于7.29 第四场 Calculus的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-29Elasticsearch慢查询日志配置
- 2024-05-29揭秘华为如此多成功项目的产品关键——Charter模板
- 2024-05-29海外IDC业务拓展的7大挑战
- 2024-05-29InLine Chat功能优化对标Github Copilot,CodeGeeX带来更高效、更直观的编程体验!
- 2024-05-29CodeGeeX 智能编程助手 6 项功能升级,在Visual Studio插件市场霸榜2周!
- 2024-05-29AutoMQ 生态集成 Apache Doris
- 2024-05-292024年IDC行业的深度挖掘:机遇、挑战与未来展望
- 2024-05-29五款扩展组件齐发 —— Volcano、Keda、Crane-scheduler 等,邀你体验
- 2024-05-29AutoMQ 对象存储数据高效组织的秘密: Compaction
- 2024-05-29活动预告|来 GIAC 大会听大数据降本利器:AutoMQ 基于云原生重新设计的 Kafka