mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 02:15:48 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace problem_279B
|
||||
{
|
||||
class problem_279B
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
int c = 0, s = 0, x = 0;
|
||||
for (int i = 0; i < ip[0]; i++)
|
||||
{
|
||||
s += a[i];
|
||||
c++;
|
||||
if (s > ip[1])
|
||||
{
|
||||
c--;
|
||||
s -= a[x];
|
||||
x++;
|
||||
}
|
||||
}
|
||||
Console.Write(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user