problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1765类 参考

洛谷 P1765 手机 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1765 手机

在文件 luogu.h543 行定义.

成员函数说明

◆ main()

int luogu::P1765::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp2009 行定义.

2009 {
2010 int ans = 0;
2011 const int nums[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4};
2012 char ch;
2013 while((ch = cin.get()) != EOF) {
2014 if(ch == ' ') {
2015 ans++;
2016 } else if(isalpha(ch) != 0) {
2017 ans += nums[ch - 'a'];
2018 }
2019 }
2020 cout << ans;
2021 return 0;
2022 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: