2026年7月30日 · 星期四
● 每日更新·改变自己
Eurekar·TOP
捕捉真实世界的英语信号
25信息来源
8,198精选文章
167单词卡片
18照片图片
全部6,459口语2,048免费395新闻1,599帖子1,379hackernews649techmeme455tmz451随笔323slashdot309外刊291arstechnica230techcrunch218Cards167simonwillison72动态69bloomberg54sethgodin43图片18youtube7

Thread 109396994

主题帖 109396994

4chan /g/ · Anonymous · 2026-07-28 23:18 · 24 帖 · 原文 ↗

← 上一篇返回列表下一篇 →
#1 Thread 109396994 / 主题帖 109396994
Anonymous · 2026-07-28 23:18

(无正文)

图片: https://i.4cdn.org/g/1785280695736442.png

#2 No.109397076
Anonymous · 2026-07-28 23:30

>>109396994

i asked claude and it failed. this question isn't possible.

我问了 Claude,它搞不定。这个问题无解。

#3 No.109397100
Anonymous · 2026-07-28 23:33

#include <limits.h>

#include <限制.h>

unsigned int length_of_longest_char_sequence(char *str, char c)

无符号整型 最长字符序列长度(字符指针 str, 字符 c)

{

unsigned int count = 0;

无符号整数计数 = 0;

unsigned int count_max = 0;

无符号整数 count_max = 0;

if (str) {

如果(字符串){

for (unsigned int i = 0; i < UINT_MAX && str[i]; ++i) {

for (无符号 int i = 0; i < UINT_MAX && str[i]; ++i) {

if (str[i] == c) {

++count;

if (count_max < count) count_max = count;

如果 (count_max < count),则将 count_max 设置为 count;

} else {

} 别的 {

count = 0;

计数=0;

}

}

}

return count_max;

返回 count_max;

}

#4 No.109397136
Anonymous · 2026-07-28 23:37

>>109397100

Couldn't a string be longer than UINT_MAX?

字符串的长度不可能超过 UINT_MAX 吗?

#5 No.109397142
Anonymous · 2026-07-28 23:38

>>109397100

>unsigned int instead of unsigned long or size_t

>用 unsigned int 而不用 unsigned long 或 size_t

Get a load of this dalit.

瞧瞧这个贱民。

#6 No.109397178
Anonymous · 2026-07-28 23:43

>>109396994

Sir, please listen.

先生,请听我说。

Dennis Ritchie created C language in early 1970s.

丹尼斯·里奇在70年代初创造了C语言。

No Google. No Stack Overflow. No GitHub. No AI. No Claude. No Cursor. No Codex.

没有Google。没有Stack Overflow。没有GitHub。没有AI。没有Claude。没有Cursor。没有Codex。

Zero, sir. Completely zero.

零,先生。完全是零。

- No venture capitalist uncle giving 2 crore for 2% equity.

- 没有那个给2%股权出2千万卢比的风险投资叔叔。

- No "product launch" with 50 YouTubers.

- 没有带着50个YouTuber的“产品发布会”。

- No TED Talk where he walks slowly from left to right.

- 没有那种他在台上从左走到右的TED演讲。

Sir, only two engineers at Bell Labs.

先生,贝尔实验室当时只有两个工程师。

Ek terminal.

一台终端。

And ek problem—"Sir, yeh Unix thoda slow ho raha hai."

然后出了一个bug——“先生,Unix有点慢。”

Dennis Ritchie sir ne language likhi.

Dennis Ritchie先生写了这门语言。

Size? Sir, kilobytes main fit ho gayi.

规模?先生,它只占几KB。

Aaj ek WhatsApp forward 10 MB ka aata hai.

今天一个WhatsApp转发消息都有10MB大。

50 years later, sir –

50年后,先生——

- Linux kernel.

- Linux内核。

- Windows.

- 窗户。

- macOS.

- Every iPhone.

- 每一部iPhone。

- Every Android.

- 每一部Android手机。

- NASA ke deep space probes.

- NASA的深空探测器。

International Space Station—sir, wahan bhi C hai.

国际空间站——先生,那儿也有C语言。

Python borrowed from it, sir. Java borrowed, with full respect. JavaScript borrowed, sir—without permission also.

Python向它借鉴,先生。Java向它借鉴,满怀敬意。JavaScript也向它借鉴,先生——连 permission(许可)都没要。

Sir, if you have ever written a single line of code in any language, even "Hello World" in college lab, you did it in Dennis Ritchie's shadow.

先生,如果你曾在任何语言里写过一行代码,哪怕只是大学机房里的“Hello World”,那你也是在Dennis Ritchie的阴影下完成的。

No shortcut. No tutorial. No "Bhaiya ek doubt hai."

没有捷径。没有教程。没有“兄弟,我有个疑问”。

And sir, he died in 2011. Same week as Steve Jobs. Steve Jobs got front pages. Covers. Special memorial. Sir, even Tribute Comments on LinkedIn.

而且先生,他在2011年去世了。和Steve Jobs同一周。Steve Jobs占据了头版。封面。特别纪念。先生,LinkedIn上全是致敬评论。

Ritchie sir got silence. Ekdum pindrop silence. Crickets sound, sir.

Ritchie先生得到的却是沉默。绝对的死寂。连蟋蟀叫声都听得见,先生。

Sir, this legend deserves celebration. No hype. No arrogance. No "break the internet." But without him, no internet to break, sir.

先生,这位传奇值得庆祝。没有炒作。没有傲慢。没有“炸翻互联网”。但如果没有他,先生,根本就没有什么互联网可以炸。

Dennis Ritchie sir – we salute you.

Dennis Ritchie先生——向您致敬。

Ek plate samosa and chai for the OG, please.

请给这位OG(元老)端上一盘萨莫萨和茶。

#7 No.109397189
Anonymous · 2026-07-28 23:44

>>109397142

>t.

图片: https://i.4cdn.org/g/1785282283864905.png

#8 No.109397219
Anonymous · 2026-07-28 23:47

>>109397178

>Steve Jobs got front pages. Covers. Special memorial.

>Steve Jobs占据了头版。封面。特别纪念。

>Sir, even Tribute Comments on LinkedIn.

>先生,LinkedIn上全是致敬评论。

Thanks for this laugh bloody benchod

谢谢你这该死的逗乐,混球(benchod)

#9 No.109397274
Anonymous · 2026-07-28 23:54

>>109397100

i suppose a driver program would be helpful, too

我想还需要一个驱动程序吧

#include <stdio.h>

int main(int argc, char *argv[])

{

if (argc < 3) {

如果 (argc < 3) {

printf("USAGE:\n\t%s <str> <char>\n", argv[0]);

printf("用法:\n\t%s <字符串> <字符>\n", argv[0]);

return -1;

返回-1;

}

char *str = argv[1];

char c = argv[2][0];

unsigned int i = length_of_longest_char_sequence(str, c);

无符号 int i = length_of_longest_char_sequence(str, c);

printf("str=%s\nc=%c\ni=%i\n\n", str, c, i);

return 0;

返回 0;

}

>>109397136

it is not possible to have a string of infinite length

不可能存在无限长的字符串

>>109397142

size_t was a mistake.

size_t 是个错误。

#10 No.109397348
Anonymous · 2026-07-29 00:07

>>109397178

kek, nice prompt for your actually indian

哈哈,给你这真正印度风的提示打满分

#11 No.109397410
Anonymous · 2026-07-29 00:15

holy shit, i got the 100 point menu

哇靠,我拿到了满分菜单

i think the poll pushed me over the edge

我觉得是那个投票把我逼疯了

图片: https://i.4cdn.org/g/1785284133133632.png

#12 No.109399432
Anonymous · 2026-07-29 05:59

>>109397274

>it is not possible to have a string of infinite length

>不可能存在无限长的字符串

So what happens if I make a string in c that's longer than UINT_MAX? Will I get a compiler error? Do I need to have some string splitting algo?

那我如果造一个在C语言里比UINT_MAX还长的字符串会怎样?编译器会报错吗?我需要搞个字符串分割算法吗?

#13 No.109399576
Anonymous · 2026-07-29 06:31

>>109399432

the program as it stands would return before getting to the null terminator

目前的程序会在到达空终止符之前就返回

this implies it can't detect a run equal to or longer than UINT_MAX.

这意味着它无法检测等于或长于UINT_MAX的连续字符序列。

accepting that limitation, there's nothing wrong with the program, and it will compile and return without issue.

接受这个局限性的话,程序本身没毛病,能正常编译并返回,不会出问题。

using size_t would allow the possibility handling c strings up to the maximum size allowed by the system. this is really the proper type to use, but gets a little annoying sometimes.

使用 size_t 允许处理最长可达系统允许最大尺寸的C字符串。这其实是正确的类型,但有时候挺烦人的。

#14 No.109400186
Anonymous · 2026-07-29 08:55

>>109396994

Please give me strength Ritchie-sama. I am but a humble retard.

请赐予我力量,Ritchie大人。我只是一个卑微的渣渣。

func challenge(c rune, r string) int {

函数挑战(c 字符, r 字符串) 整数 {

var best int = 0

var 最佳整数 = 0

var cur int = 0

var 当前整数 = 0

for _, cc := range r {

对于 r 中的每个 cc,执行以下操作:

if cc == c {

cur++

} else {

} 别的 {

best = max(best, cur)

最佳值 = max(最佳值, 当前值)

cur = 0

当前 = 0

}

}

return max(best, cur)

返回最大值(最佳,当前)

}

#15 No.109400799
Anonymous · 2026-07-29 11:05

a much more interesting algorithm problem is to determine the m-th largest number in an array of N numbers

一个更有趣的算法问题是:在 N 个数的数组中找出第 m 大的数

#16 No.109401600
Anonymous · 2026-07-29 13:47

>>109400799

man 3 qsort

人 3 排序

#17 No.109401733
Anonymous · 2026-07-29 14:09

max(find(diff[0 str == c 0] == -1) - find(diff[0 str == c 0] == 1))

There's also a function that can do this:

还有个函数能做到这一点:

sum(bwareafilt(str == c, 1))

#18 No.109401923
Anonymous · 2026-07-29 14:34

>>109396994

who needs an algorithm when you can use an existing function

既然有现成的函数,谁还需要算法呢

#19 No.109405093
Anonymous · 2026-07-29 21:13

>>109401600

terrible space usage and time complexity for the problem you are trying to solve, not a good algorithm to use in this case

空间占用和时间复杂度对于你要解决的问题来说都很糟糕,这种情况下这不是个好算法

#20 No.109405103
Anonymous · 2026-07-29 21:14

>>109401733

>There's also a function that can do this:

>还有个函数能做到这一点:

yeah, i wrote it in the second post

是的,我在二楼的回复里写了

length_of_longest_char_sequence(str, c)

最长字符序列的长度(str,c)

#21 No.109405182
Anonymous · 2026-07-29 21:24

>>109396994

odin can be quite comfy sometimes.

Odin(编程语言)有时候真的挺舒服的。

long_seq :: proc(c: rune, s: string) -> (l: int) {

l = 0

lc := 0

for rune in s {

对于 s 中的符文 {

if rune == c {

如果 rune == c {

lc += 1

l = max(l, lc)

l = 最大值(l, lc)

} else {

} 别的 {

lc = 0

}

}

return

}

#22 No.109405339
Anonymous · 2026-07-29 21:43

>>109397178

why dont you just speak one language at a time, poopkings?

你们这些屎王能不能一次只说一门语言?

#23 No.109405509
Anonymous · 2026-07-29 22:05

>>109405182

>rune

what's odin's rune definition? grapheme?

Odin 的 rune 是怎么定义的?是字素(grapheme)吗?

i recently worked on font shaping for a graphics project and in graphical contexts, grapheme segmentation rerquires having gsub tables for the fonts you're using in order to segment codepoints into graphems (glyphs)

我最近在做一个图形项目的字体 shaping,在图形环境下,字素分割需要你所用字体具备 gsub 表,才能将代码点分割成字素(glyph)

#24 No.109405513
Anonymous · 2026-07-29 22:06

>>109396994

i dont know how to code

我不会写代码

← 上一篇返回列表下一篇 →

(如果你觉得这篇文章有启发,可以点击这里付费