社区讨论
神奇bug,这是UB吗?
学术版参与者 4已保存回复 6
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 6 条
- 当前快照
- 1 份
- 快照标识符
- @m090qwhj
- 此快照首次捕获于
- 2024/08/25 11:37 2 年前
- 此快照最后确认于
- 2025/11/04 22:29 4 个月前
系统Win7旗舰版 使用Dev-c++5.11 编译器32bit Release
在做P1229
写出来了这玩意
写出来了这玩意
c="里面是随便打的"
逆天机房电脑截不了图
CPP#include<iostream>
#include<cstring>
int n,x=1;
std::string a,b,c;
int main(){
std::cin>>a>>b;
n=a.size()-1;
for(int i=0;i<n;++i){
c=/*"u89asud8fu89sadu8f9usdi09fiosdof-0o-sdof[dfo0i09df9id8fjd]"+*/a[i]+a[i+1];std::cout<<c<<'\n';
if(b.find(c))x<<=1;
}printf("%d",x);
}
将
TEXTc=/*"u89asud8fu89sadu8f9usdi09fiosdof-0o-sdof[dfo0i09df9id8fjd]"+*/a[i]+a[i+1];std::cout<<c<<'\n';中的/**/删掉后输出了这个:abc
cba
ic_string::at: __n (which is %zu) >= this->size() (which is %zu)
_string::at: __n (which is %zu) >= this->size() (which is %zu)
4
--------------------------------
Process exited after 0.4427 seconds with return value 0
请按任意键继续. . .
(abc 和 cba 是输入)
又写了一个:
CPP#include<iostream>
#include<cstring>
int n,x=1;
std::string a,b,c;
int main(){
std::cin>>a>>b;
n=a.size()-1;
for(int i=0;i<n;++i){
c="8a9syd89ysad98shdfuh9s78hdfs78dfgy7gsdft67tdf"+a[i]+a[i+1];std::cout<<c<<'\n';
if(b.find(c))x<<=1;
}printf("%d",x);
}
TEXTabc
cba
t: __n (which is %zu) >= this->size() (which is %zu)
__n (which is %zu) >= this->size() (which is %zu)
4
--------------------------------
Process exited after 0.2081 seconds with return value 0
请按任意键继续. . .
在Linux上输出啥也没有。
求问为啥
求问为啥
回复
共 6 条回复,欢迎继续交流。
正在加载回复...