POJ 3094 Quicksum(简单的问题)

【简要题意】:题意是非常easy。

看样能理解

【分析】:略。

读取字符串。

// 200K 0Ms
#include<iostream>
using namespace std;

int main()
{
	char a[256];
	while(1)
	{
		int sum = 0;
		gets(a);
		if(strcmp(a,"#")==0) break;
		int len = strlen(a);
		for(int i = 0;i<len;i++)
		{
			if(a[i] == ' ')
				sum += 0;
			else
				sum += (a[i]-'A'+1)*(i+1);
		}
		cout<<sum<<endl;
	}
	return 0;
}

版权声明:本文博主原创文章,博客,未经同意不得转载。

时间: 2024-08-06 07:54:50

POJ 3094 Quicksum(简单的问题)的相关文章

POJ 3094 Quicksum(简单题)

[题意简述]:题意很简单.看例子就能理解 [分析]:略.字符串的读取操作. // 200K 0Ms #include<iostream> using namespace std; int main() { char a[256]; while(1) { int sum = 0; gets(a); if(strcmp(a,"#")==0) break; int len = strlen(a); for(int i = 0;i<len;i++) { if(a[i] ==

POJ 3094 Quicksum 难度:0

http://poj.org/problem?id=3094 1 #include<iostream> 2 #include <string> 3 using namespace std; 4 int main() 5 { 6 string str; 7 getline(cin,str); 8 while(str != "#") 9 { 10 int ans = 0; 11 for(int i = 0;i < str.length(); i++) 12 {

POJ - 3094 - Quicksum = 水题

http://poj.org/problem?id=3094 学习fgets的使用,注意fgets是会连换行一起保存的. #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<map> #include<set> #include<stack> #include<

poj 3094 Quicksum

#include <stdio.h> #include <string.h> char word[301]; int main() { int sum = 0; int i,len; while(gets(word)) { sum = 0; if(word[0] == '#') break; len = strlen(word); for(i = 0; i < len; ++i) { if(word[i] != ' ') sum += (i+1) * (word[i]-'A'

[容斥原理] poj 3094 Sky Code

题目链接: http://poj.org/problem?id=3904 Sky Code Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1334   Accepted: 405 Description Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraf

POJ 1469 COURSES //简单二分图

COURSES Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17211   Accepted: 6769 Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is poss

poj 3279 Fliptile (简单搜索)

Fliptile Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16558   Accepted: 6056 Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in whic

POJ 1260 Pearls 简单dp

1.POJ 1260 2.链接:http://poj.org/problem?id=1260 3.总结:不太懂dp,看了题解 http://www.cnblogs.com/lyy289065406/archive/2011/07/31/2122652.html 题意:珍珠,给出需求,单价,要求用最少的钱就可以买到相同数量的,相同(或更高)质量的珍珠. 把握题意,1.输入时,后输入的珍珠价格一定比前面输入的要贵.2.用高质量珍珠替代低质量. #include<iostream> #include

POJ 2481 Cows 简单树状数组区间覆盖

点击打开链接 Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 13334   Accepted: 4413 Description Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line