Living one day at a time (update for a long time)
1, http://acm.hdu.edu.cn/showproblem.php?pid=1228 2014-04-14 10:39:52
分析:字符串处理题。。。

#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cstring> #include<map> using namespace std; map<string,int> mp; void init(){ mp["zero"]=0; mp["one"]=1; mp["two"]=2; mp["three"]=3; mp["four"]=4; mp["five"]=5; mp["six"]=6; mp["seven"]=7; mp["eight"]=8; mp["nine"]=9; mp["+"]=0; mp["="]=0; } int main(){ //freopen("input.txt","r",stdin); char str[1100]; init(); while(~scanf("%s",str)){ int ans=0; int tmp1=0,tmp2=0; int flag=0; tmp1=mp[str]; while(scanf("%s",str) && strcmp(str,"=")!=0){ if(strcmp(str,"+")==0){ flag=1; continue; } if(flag==0){ tmp1=tmp1*10+mp[str]; }else{ tmp2=tmp2*10+mp[str]; } } ans=tmp1+tmp2; if(ans==0) break; printf("%d\n",ans); } return 0; }
2, http://acm.hdu.edu.cn/showproblem.php?pid=1229 2014-04-14 10:48:57
分析:easy题。。。

#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cstring> #include<map> using namespace std; int main(){ // freopen("input.txt","r",stdin); int a,b,k; while(~scanf("%d%d%d",&a,&b,&k)){ int tmp=1; if(a+b==0) break; while(k!=0){ tmp*=10; k--; } if(a%tmp-b%tmp==0){ printf("-1\n"); }else{ printf("%d\n",a+b); } } return 0; }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2013-04-14 HDU 4289 Control (Dinic)
2013-04-14 POJ 3414 Pots (BFS)
2013-04-14 HDU 4292 Food (SAP | Dinic )
2013-04-14 POJ 3216 Repairing Company (二分匹配)
2013-04-14 POJ 2457 Part Acquisition
2013-04-14 POJ 1459 Power Network (Dinic非递归 | SAP)