Attack
Time Limit: 5000/3000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 1890 Accepted Submission(s): 554
Problem Description
Today is the 10th Annual of “September 11 attacks”, the Al Qaeda is about to attack American again. However, American is protected by a high wall this time, which can be treating as a segment with length N. Al Qaeda has a super weapon,
every second it can attack a continuous range of the wall. American deployed N energy sh......
阅读全文
A题:给你一串只有0和1的字符串,让你通过使一个区间异或后所得的字符串中1的个数最大。
小结:题目以来没想太多,以为是找最长有多少个0,直接交了一发WA,最后看了下数据,暴力秒过。
代码:
#include<iostream>
using namespace std;
int sum[105];
int a[105];
int main()
{
int n;
cin>>n;
sum[0]=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
sum[i]=sum[i-1]+a[i];
}
int max=-1;
int ans1,ans2;
for(int i=1;i<=n;i++)
{
for(int j=......
阅读全文
在使用JdbcTemplate的时候,当调用类似queryForInt(String sql,args)等方法时,其返回值是int类型(或者String类型),这个时候因为我们的sql语句导致了如题的错误。如果返回的是int类型,则查询的结果应该是int类型的,现在举例如下:
//错误的sql代码
public int login(String name, String password) {
// TODO Auto-generated method stub
return jdbcTemplate.queryForInt(
"select * from user where name=? and password=?",
new Object[] { name, password });
}
以上代码导致如题错误
这样是错误的,因......
阅读全文