随笔分类 - PTA-Basic level
摘要:#include <iostream> using namespace std; int main() { int n,a=-1,b=-1,c=-1; cin>>n; if(n>0) { a=n%10; n=n/10; if(n>0) { b=n%10; n=n/10; } if(n>0) { c=
阅读全文
摘要:memset(mark,-1,sizeof(mark));对每个输入的数,将它所包含的数标志置1,本身标志置0.最后输出所有标志为0的数。 #include <iostream> using namespace std; int main() { int k,flag=0; cin>>k; int
阅读全文
摘要:结构体数组的定义和使用 struct STU { char sname[10]; char sno[10]; int grade; }; struct STU stu[101]; #include <iostream> using namespace std; struct STU { char s
阅读全文
摘要:'\0' : 字符串结束标识符,也是空字符,ascii码为00 APAT-YES APAATA-NO,因为c为空字符,即字符串结束。 APAATAA-NO #include <iostream> using namespace std; int main() { int n,i; int sign
阅读全文
摘要:#include <iostream> #include <cstring> using namespace std; int main() { char num[101]; char out[11][10] = {"ling","yi","er","san","si","wu","liu","qi
阅读全文
摘要:#include <iostream> using namespace std; int main() { int n,step=0; cin>>n; while(n!=1) { if(n%2==0) n=n/2; else n=(3*n+1)/2; step++; } cout<<step<<en
阅读全文

浙公网安备 33010602011771号