浙江工业大学ACM部分答案
1000
Name: A+B Problem
#include<iostream>
#include<fstream>
using namespace std;
//---------------------------
int main(){
ifstream cin("1000.txt");
int num1,num2;
for(;cin>>num1>>num2&&!(num1==0&&num2==0);)
cout<<num1+num2<<endl;
}
1001
Name: 密码截获
#include<iostream>
#include<fstream>
#include<algorithm>
#include<sstream>
using namespace std;
//---------------------------
string reverseStr(string s){
string temp=s;
for(int a=0;a<s.length();a++)
temp[a]=s[s.length()-a-1];
return temp;
}
bool isPassword(string s){
bool ispassword=0;
if(s==reverseStr(s))
ispassword=1;
return ispassword;
}
string testWord(string s){
string result="ab";
for(int i=0;isPassword(result)==false&&i<s.length();i++){
for(int a=i;a>=0;a--){
result=s.substr(a,s.length()-i);
if(isPassword(result))
break;
}
}
return result;
}
int main(){
ifstream cin("1001.txt");
string str;
for(;cin>>str;)
cout<<testWord(str).length()<<endl;
}
1002
Name:数字游戏
#include<iostream>
#include<fstream>
#include<algorithm>
#include<sstream>
#include<cmath>
using namespace std;
//---------------------------
int main(){
ifstream cin("1002.txt");
int a;
for(;cin>>a;){
int mulbase=sqrt(a*1.0);
int mul=mulbase;
int count=1;
bool flag=0;
for(int i=mulbase;mul!=a&&i>=2;i--){
if(a%i==0){
mul=i;
count=1;
//cout<<"约数为"<<i<<endl;
while(mul<a){
count++;
mul*=i;
if(mul==a){
flag=1;
cout<<i<<" "<<count<<endl;
break;
}
} }
}
if(flag==0&&a!=0)
cout<<0<<" "<<0<<endl;
}
}
1003
Name: Tight words
1004
Name: Jolly Jumpers
1005
Name: 做幻方(用”爬楼梯法”求解)
#include<iostream>
#include<fstream>
#include<sstream>
#include<vector>
#include<iomanip>
using namespace std;
//-------------------------
int main(){
ifstream cin("1005.txt");
int t=0;
for(int a;cin>>a &&a!=0;){
if(t++) cout<<endl;
vector<vector<int> > vv;
for(int i=0;i<a;i++){
vector<int> temp;
for(int j=0;j<a;j++)
temp.push_back(0);
vv.push_back(temp);
}
int row=a-1;
int con=a/2;
vv[row][con]=1;
for(int k=2;k<=a*a;k++){
if(vv[(row+1)%a][(con+1)%a]!=0){
if(row-1==-1){
vv[a+row-1][con]=k;
row=a+row-1;}
else{
vv[row-1][con]=k;
row--;}
}
else{
vv[(row+1)%a][(con+1)%a]=k;
row=(row+1)%a;
con=(con+1)%a;
}
}
for(int x=0;x<a;x++){
cout.width(3);
cout<<vv[x][0];
for(int y=1;y<a;y++){
cout.width(3);
cout<<right<<setfill(' ')<<vv[x][y];
}
cout<<endl;
}
}
}
1006
Name: Mr. Young's Picture Permutations
1007
Name: Jumping Cows
#include<iostream>
#include<fstream>
#include<algorithm>
#include<sstream>
#include<vector>
using namespace std;
//---------------------------
int main(){
ifstream cin("1007.txt");
for(int a;cin>>a;){
vector<i
浙江工业大学ACM部分答案... 35页 免费 ACM算法集锦 25页 1下载券 清华大学...浙江工业大学 ACM 部分程序解读程序设计导引及在线实践 最重要的是边界:输入的...
杭电acm部分答案001_计算机软件及应用_IT/计算机_专业资料。关于杭电acm的部分试题答案,都是本人上机提交过的正确答案,答案不是标准答案,仅供参考...
杭电ACM部分题目答案_IT/计算机_专业资料。杭电ACM部分题目答案杭电ACM 1001 Sum Problem... 2 1089 A+B for Input-Output Practice...
浙江工业大学物理化学历年期末考试题与答案试_理学_高等教育_教育专区 暂无评价0人阅读0次下载举报文档 浙江工业大学物理化学历年期末考试题与答案试_理学_高等...
ACM部分练习题目答案_工学_高等教育_教育专区。ACM 部分习题答案: A + B Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (...
浙江工业大学机械设计习... 21页 1下载券 机械设计试卷及答案 12页 免费 机械设计练习题及答案 7页 1下载券浙江工业大学机械...
页 浙江工业大学考试命题纸 选择题答题区,答案必须填入下表,否则不予记分题号? 1? 答案? D? 题号? 11? 答案? B? 2? C? 12? B? 3? A? 13? B? ...
页 浙江工业大学考试命题纸 选择题答题区,答案必须填入下表,否则不予记分题号? 答案? 题号? 答案? C? 11? C? 1? B? 12? A? 2? D? 13? A? 3? ...
acm.zju.edu.cn/ 浙江工商大学 http://acm.hzic.edu.cn/ 浙江工业大学(... 2014年12月大学四级冲刺试题及答案 2014年12月大学英语四级经典参考范文80份...
热门文档